//
3des24_encode_cbc ( ansi_string ( "01234567" ) , ansi_string ( "123" ) , ansi_string ( "liuyunqiang@lx100$#365#$" ) ) 
//----
ansi_string convert utf16-little-endian format input data to ansi format
//----
  input = 30 00 31 00 32 00 33 00 34 00 35 00 36 00 37 00 
//----
  output = 30 31 32 33 34 35 36 37 
//

//----
ansi_string convert utf16-little-endian format input data to ansi format
//----
  input = 31 00 32 00 33 00 
//----
  output = 31 32 33 
//

//----
ansi_string convert utf16-little-endian format input data to ansi format
//----
  input = 6C 00 69 00 75 00 79 00 75 00 6E 00 71 00 69 00 61 00 6E 00 67 00 40 00 6C 00 78 00 31 00 30 00 30 00 24 00 23 00 33 00 36 00 35 00 23 00 24 00 
//----
  output = 6C 69 75 79 75 6E 71 69 61 6E 67 40 6C 78 31 30 30 24 23 33 36 35 23 24 
//

//--
triple(24k) des cbc encrypt
//--
key = 6C 69 75 79 75 6E 71 69 61 6E 67 40 6C 78 31 30 30 24 23 33 36 35 23 24 
//--
icv = 30 31 32 33 34 35 36 37 plain = 31 32 33 00 00 00 00 00 
//--
xor = 01 03 01 33 34 35 36 37   cipher = 5A 68 5A 2C 8D 73 23 70 
//

//-----
Final result --- 5A 68 5A 2C 8D 73 23 70 
//

解决方案 »

  1.   

    你加密的结果是多少?你的结果转化出来的字符串是什么样的,大写还是小写?你base64的结果是什么?
      

  2.   

    字符串:123
    加密后base64:LxMdvv1fQnc=
    key:liuyunqiang@lx100$#365#$
    iv:01234567
    加密后十六进制:
    2f 13 1d be fd 5f 42 77
      

  3.   

    加密前字符:123abc456efg
    base64加密后结果:X7/YXdV5a3qbqE7d8T5RFA==
    加密后十六进制:
     5f bf d8 5d d5 79 6b 7a 9b a8 4e dd f1 3e 51 14非常感谢!
      

  4.   


    //
    3des24_decode_cbc ( ansi_string ( "01234567" ) , 5f bf d8 5d d5 79 6b 7a 9b a8 4e dd f1 3e 51 14 , ansi_string ( "liuyunqiang@lx100$#365#$" ) ) 
    //----
    ansi_string convert utf16-little-endian format input data to ansi format
    //----
      input = 30 00 31 00 32 00 33 00 34 00 35 00 36 00 37 00 
    //----
      output = 30 31 32 33 34 35 36 37 
    //

    //----
    ansi_string convert utf16-little-endian format input data to ansi format
    //----
      input = 6C 00 69 00 75 00 79 00 75 00 6E 00 71 00 69 00 61 00 6E 00 67 00 40 00 6C 00 78 00 31 00 30 00 30 00 24 00 23 00 33 00 36 00 35 00 23 00 24 00 
    //----
      output = 6C 69 75 79 75 6E 71 69 61 6E 67 40 6C 78 31 30 30 24 23 33 36 35 23 24 
    //

    //--
    triple(24k) des cbc decrypt
    //--
    key = 6C 69 75 79 75 6E 71 69 61 6E 67 40 6C 78 31 30 30 24 23 33 36 35 23 24 
    //--
    icv = 30 31 32 33 34 35 36 37 cipher = 5F BF D8 5D D5 79 6B 7A 
    //--
      plain = 01 03 01 52 56 56 02 02 xor = 31 32 33 61 62 63 34 35 
    //--
    icv = 5F BF D8 5D D5 79 6B 7A cipher = 9B A8 4E DD F1 3E 51 14 
    //--
      plain = 69 DA BE 3A D1 7D 6F 7E xor = 36 65 66 67 04 04 04 04 
    //

    //-----
    Final result --- 31 32 33 61 62 63 34 35 36 65 66 67 04 04 04 04 
    //

    //
    to_ansi_string ( 31 32 33 61 62 63 34 35 36 65 66 67 04 04 04 04 ) 
    //--
    to_ansi_string convert ansi format input data to string
    //--
      input = 31 32 33 61 62 63 34 35 36 65 66 67 04 04 04 04 
    //--
      output = "123abc456efg"
    //

    //-----
    Final result --- "123abc456efg"
    //

    这是你的字符串,解密之后的结果,可以看出,后面补了4个04,所以如果加密123的话,后面可能补5个05
      

  5.   


    //
    3des24_encode_cbc ( ansi_string ( "01234567" ) , ansi_string ( "123" ) 0505050505 , ansi_string ( "liuyunqiang@lx100$#365#$" ) ) 
    //----
    ansi_string convert utf16-little-endian format input data to ansi format
    //----
      input = 30 00 31 00 32 00 33 00 34 00 35 00 36 00 37 00 
    //----
      output = 30 31 32 33 34 35 36 37 
    //

    //----
    ansi_string convert utf16-little-endian format input data to ansi format
    //----
      input = 31 00 32 00 33 00 
    //----
      output = 31 32 33 
    //

    //----
    ansi_string convert utf16-little-endian format input data to ansi format
    //----
      input = 6C 00 69 00 75 00 79 00 75 00 6E 00 71 00 69 00 61 00 6E 00 67 00 40 00 6C 00 78 00 31 00 30 00 30 00 24 00 23 00 33 00 36 00 35 00 23 00 24 00 
    //----
      output = 6C 69 75 79 75 6E 71 69 61 6E 67 40 6C 78 31 30 30 24 23 33 36 35 23 24 
    //

    //--
    triple(24k) des cbc encrypt
    //--
    key = 6C 69 75 79 75 6E 71 69 61 6E 67 40 6C 78 31 30 30 24 23 33 36 35 23 24 
    //--
    icv = 30 31 32 33 34 35 36 37 plain = 31 32 33 05 05 05 05 05 
    //--
    xor = 01 03 01 36 31 30 33 32   cipher = 2F 13 1D BE FD 5F 42 77 
    //

    //-----
    Final result --- 2F 13 1D BE FD 5F 42 77 
    //
    加密格式已经蒙对了。
      

  6.   


    //
    base64_encode ( 2F 13 1D BE FD 5F 42 77 ) 
    //--
    base64 encode make data to string
    //--
      input = 2F 13 1D BE FD 5F 42 77 
    //--
      output = 4C 00 78 00 4D 00 64 00 76 00 76 00 31 00 66 00 51 00 6E 00 63 00 3D 00 
    //

    //-----
    Final result --- LxMdvv1fQnc=
    //
    base64也蒙对了,就对16进制数进行操作就行了,你只要注意加密数据的格式就行了。