Thread Digest::MD5 aus Java
(6 answers)
Opened by maart at 2012-08-01 17:49
Also ich bekomme das selbe Ergebnis:
Code (java): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 package md5_test; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class md5_test { public static void main(String[] args) { byte[] var0 = "hallo@fehl".getBytes(); byte[] var1 = "1112".getBytes(); try { MessageDigest var2 = MessageDigest.getInstance("MD5"); var2.update(var0); byte message[] = var2.digest(var1); for ( int i=0; i<message.length; i++ ) { String hex = Integer.toHexString(0xFF & message[i]); if(hex.length()==1) { System.out.print('0'); } System.out.print(hex); } System.out.println(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } } } Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 #!/usr/bin/perl use strict; use warnings; use Digest::MD5; my $md5 = Digest::MD5->new; $md5->add('hallo@fehl','1112'); my $message = $md5->digest; print unpack('H*',$message)."\n"; Und da fragen mich Leute warum ich lieber in Perl Programmiere. ;-) |