github.com/iikira/iikira-go-utils@v0.0.0-20230610031953-f2cb11cde33a/utils/bdcrypto/des_test.go (about) 1 package bdcrypto_test 2 3 import ( 4 "fmt" 5 "github.com/iikira/iikira-go-utils/utils/bdcrypto" 6 "testing" 7 ) 8 9 func TestDESCBCDecrypt3(t *testing.T) { 10 data := bdcrypto.Base64Decode([]byte( 11 "4D2a4IsjSyD1GHh+w2IfMCTdO0uxHBFbzKVP4l81z+UZY2LzKqhovEcymeYeFW2lDWZSa56cS16lHjbN7woyyFNu+DMAeUaFA+4JWI/7zNXgqicIYpAcPtPZgdiLRpZzKB55q4+df9BSKC+dHge7dIK+Jv2fmV8vIWwvDL/1JYLB/LSB55IZ+BQQS9kPSCLju/snryQFPzHMlgHDNsTjqZWGDmOfMfXR/WriX+9Qkh1fu1zld28T7H+GgVSkyD1ldzDsTZU6vwxJk1Fyqzl2BtoB7OAFxbPWAGipKtTycN+ss/4sQpDLKPrnUJWcWfKb635v3wK+t1bfS7U+shWPKU5DoPLfXch/xEakF2Q7mXSGFxSs//ajvpS5YnovGCTd4iX2FsMOqB9sdCAx8l5CTGYWXuyDsrwxaJKeENav0lBLLqtd5X83VIv2YAs86pJUQEUPBI0wNlPNkEVFH+XFku/xIMavUvXC1hhwEwQy2apntyd+jiq0rwgDd+tJpcDTAzUa6SvgmMT97DN0FogPuqQ3Dar9HsvjNkv87RI+TCJSABWUVJvw+mzjfgaJL5cF", 12 )) 13 ciphertext, _ := bdcrypto.DESCBCDecrypt3(data, []byte("fHSgdfH326XJ@328%521DSAg"), []byte("01234567")) 14 fmt.Printf("%s\n", ciphertext) 15 16 data = bdcrypto.Base64Decode([]byte( 17 "LuuPxoAsuEkjRyUD+W2/AiDc/f2cpNukHi+OmlhzuTkmN+41o3DHgw2e9J9LF9Y/8TuwikZcN1byG2oQq+KYaFOQrTqWzBSAWEAanJPHn1tH0PvhsiJkhawt9jLdqdzZo5AkzJcGj8/LmSDsmX8aSQRp0F1alnp1rMHI3Y1vbgTHa+2spp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