题目内容:这里有一段丢失的md5密文 e9032???da???08????911513?0???a2 要求你还原出他并且加上nctf{}提交 已知线索 明文为: TASC?O3RJMV?WDJKX?ZM 题目来源:安恒杯
简单的MD5密码碰撞,通过对比密文e9032 与加密后的数据 定位相关信息
解题代码如下
GO语言版
package main
import (
"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
rune2 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"+string(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版
<?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";
}
}
}
}
有疑问加站长微信联系(非本文作者)