Md5-golang and PHP Code implementation of CTF cryptography in Nanjing University of Posts and telecommunications

Source: Internet
Author: User

Title content: Here is a lost MD5 ciphertext e9032??? Da??? ???? 911513?0??? A2 asks you to restore him and add nctf{} to commit the known clue in plaintext: TASC? O3rjmv? Wdjkx? ZM Topic Source: Anheng Cup
Simple MD5 password collisions, by comparing ciphertext e9032 with encrypted data location related information
The problem code is as follows

Go language version

Package Mainimport ("crypto/md5" "io" "Encoding/hex" "Strings" "FMT") var Enable = []rune{' A ', ' B ', ' C ', ' D ', ' E ', ' F ', ' G ', ' H ', ' I ', ' J ', ' K ', ' L ', ' M ', ' N ', ' O ', ' P ', ' Q ', ' R ', ' S ', ' T ', ' U ', ' V ', ' W ', ' X ', ' Y ', ' Z ', ' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 ', ' 6 ' , ' 7 ', ' 8 ', ' 9 ', ', '! ', ' "', ' # ', ' $ ', '% ', ' & ', ' \ ', ' (', ') ', ' * ', ' + ', ', ', '-', '. ', '/', ': ', '; ', ' < ', ' = ', ' > ', '? ', ' @ ', ' [', ' \ \ ', '] ', ' ^ ', ' _ ', ' ', ' a ', ' B ', ' C ', ' d ', ' e ', ' f ', ' g ', ' h ', ' I ', ' j ', ' K ', ' l ', ' m ', ' n ', ' O ', ' P ', ' Q ', ' R ', ' s ', ' t ', ' u ', ' V ', ' w ', ' x ', ' y ', ' z ', ' {', ' | ', '} ', ' ~ '}func main () {var (rune1 rune R Une2 Rune Rune3 rune) for i:=0;            i< len (enable); i++ {rune1 = enable[i] for j:=0; j< len (enable); J + + {Rune2 = Enable[j] For k:=0; k< Len (Enable); k++ {rune3 = enable[k] Strtodecode: = "TASC" +string (rune1) + "O3RJMV" +stri Ng (rune2) + "Wdjkx" +string (rune3) + "ZM" str: = MD5. New () Io. WriteString (str, strtodecode) hexstr: = str. Sum (nil) Code: = Hex. Encodetostring (hexstr) Result: = "e9032" COM01: = Strings. Contains (code,result) If com01 = = true {fmt. Println (Strtodecode,code)}}}}

PHP version

<?php    $list = array(        'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9',' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@','[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~'    );    for ($i=0;$i<count($list);$i++){        $str1 = $list[$i];        for ($j=0;$j<count($list);$j++){            $str2 = $list[$j];            for ($k=0;$k<count($list);$k++){                $str3 = $list[$k];                $str = "TASC".$str1."O3RJMV".$str2."WDJKX".$str3."ZM";                $md5 = md5($str);                if(strstr($md5,"e9032")){                    echo $str."---".$md5."\n";                }            }        }    }
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.