<?php header( "Content-Type: text/html; charset=UTF-8" ); $utf8string = ", !" ; echo '<pre>' .$utf8string. '</pre>' ; echo '<pre>' .md5($utf8string). '</pre>' ; ?> * This source code was highlighted with Source Code Highlighter .
<?php header( "Content-Type: text/html; charset=UTF-8" ); $utf8string = ", !" ; echo '<pre>' .$utf8string. '</pre>' ; echo '<pre>' .md5($utf8string). '</pre>' ; ?> * This source code was highlighted with Source Code Highlighter .
<?php header( "Content-Type: text/html; charset=UTF-8" ); $utf8string = ", !" ; echo '<pre>' .$utf8string. '</pre>' ; echo '<pre>' .md5($utf8string). '</pre>' ; ?> * This source code was highlighted with Source Code Highlighter .
<?php header( "Content-Type: text/html; charset=UTF-8" ); $utf8string = ", !" ; echo '<pre>' .$utf8string. '</pre>' ; echo '<pre>' .md5($utf8string). '</pre>' ; ?> * This source code was highlighted with Source Code Highlighter .
<?php header( "Content-Type: text/html; charset=UTF-8" ); $utf8string = ", !" ; echo '<pre>' .$utf8string. '</pre>' ; echo '<pre>' .md5($utf8string). '</pre>' ; ?> * This source code was highlighted with Source Code Highlighter .
<?php header( "Content-Type: text/html; charset=UTF-8" ); $utf8string = ", !" ; echo '<pre>' .$utf8string. '</pre>' ; echo '<pre>' .md5($utf8string). '</pre>' ; ?> * This source code was highlighted with Source Code Highlighter .
<?php header( "Content-Type: text/html; charset=UTF-8" ); $utf8string = ", !" ; echo '<pre>' .$utf8string. '</pre>' ; echo '<pre>' .md5($utf8string). '</pre>' ; ?> * This source code was highlighted with Source Code Highlighter .
<?php header( "Content-Type: text/html; charset=UTF-8" ); $utf8string = ", !" ; echo '<pre>' .$utf8string. '</pre>' ; echo '<pre>' .md5($utf8string). '</pre>' ; ?> * This source code was highlighted with Source Code Highlighter .
Hello World!
c446a2994f35689482651b7c7ba8b56c
* This source code was highlighted with Source Code Highlighter .
- public class Md5Tester {
- public static void main ( String [] args) throws java.io.UnsupportedEncodingException, java.security.NoSuchAlgorithmException {
- java.io.PrintStream sysout = new java.io.PrintStream (System. out , true , "UTF-8" );
- String utf8_string = "Hello world!" ;
- sysout.println (utf8_string);
- java.security.MessageDigest md5 = java.security.MessageDigest.getInstance ( "MD5" );
- byte [] md5_byte_array = md5.digest (utf8_string.getBytes ());
- String md5_string = new String (md5_byte_array);
- sysout.println (md5_string);
- }
- }
C: \ Sun \ SDK \ jdk \ bin \ java -Didea.launcher.port = 7552 "-Didea.launcher.bin.path = C: \ Program Files (x86) \ JetBrains \ IntelliJ IDEA 8.1.3 \ bin" - Dfile.encoding = UTF-8 ...
Hello World!
F O5h e | { l
* This source code was highlighted with Source Code Highlighter .
- ...
- java.math.BigInteger md5_biginteger = new java.math.BigInteger (1, md5_byte_array);
- sysout.println (md5_biginteger.toString (16));
Hello World!
c446a2994f35689482651b7c7ba8b56c
rbablord5
9736a8436e10bf1991927f2ffc76c12
* This source code was highlighted with Source Code Highlighter .
- String md5_string = DigestUtils.md5Hex (utf8_string);
* This source code was highlighted with Source Code Highlighter .
- private static final char [] DIGITS_LOWER = { '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , ' a ' , ' b ' , ' c ' , ' d ' , ' e ' , ' f ' };
- private static final char [] DIGITS_UPPER = { '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , ' A ' , ' B ' , ' C ' , ' D ' , ' E ' , ' F ' };
- protected static String encodeHex ( byte [] data, char [] toDigits) {
- int l = data.length;
- char [] out = new char [l << 1];
- // two characters form the hex value.
- for ( int i = 0, j = 0; i <l; i ++) {
- out [j ++] = toDigits [(0xF0 & data [i]) >>> 4];
- out [j ++] = toDigits [0x0F & data [i]];
- }
- return new String ( out );
- }
Source: https://habr.com/ru/post/73952/
All Articles