Auf Thema antworten

Ich verwende hier Standard-Mechanismen der jeweiligen Programmiersprache:


Java:

[Java]

private static void cryp(){

        String word = "Hallo";

       

        printBytes(word.getBytes());

        try {

            MessageDigest crypter = MessageDigest.getInstance("SHA-512");

           

            byte[] wordCrypt = crypter.digest(word.getBytes());

            printBytes(wordCrypt);

        } catch (NoSuchAlgorithmException e) {

            // TODO Auto-generated catch block

            e.printStackTrace();

        }

    }

   

    public static void printBytes(byte[] bytes){

        for (int i = 0; i < bytes.length; i++)

        {

            System.out.println(bytes);

        }

    }

[/Java]


C#:

[Code]

static void Main(string[] args)

        {

           printBytes(System.Text.ASCIIEncoding.ASCII.GetBytes("Hallo"));

           SHA512Managed lo_SHA = new SHA512Managed();

           lo_SHA.Initialize();

           byte[] Buffer = lo_SHA.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes("Hallo"));

           printBytes(Buffer);

         }


private static void printBytes(byte[] bytes)

        {

            for (int i = 0; i < bytes.Length; i++)

            {

                Console.WriteLine(bytes[i].ToString());

            }

        }

[/Code]



Oben