“123”经过加密之后是“R2AKd+aZ0K4=”请教高手问怎么样才可以知道是使用什么加密算法的呢?

解决方案 »

  1.   

    貌似是Base64System.Text.Encoding.Default.GetString(Convert.FromBase64String("R2AKd+aZ0K4="))
    也可能是SHA1如果是SHA1的话就没办法解密了
      

  2.   

    楼上说的Base64和SHA1我都试过了,123加密之后都不是那样的密码字符串
      

  3.   

    刚才用IL反编译看了一下
    那应该是对称加密,在用key加密之后,还来1次base64加密~~反编译后显示结构
    .class public auto ansi
    arrDESIV : private unit8[]
    arrDESKey : private unit8[]
    .ctor : void()
    Decrypt : string(string)
    Encrypt : string(string)Encrypt方法具体描述
    .method public instance string  Encrypt(string m_Need_Encode_String) cil managed
    {
      // 代码大小       102 (0x66)
      .maxstack  4
      .locals init (string V_0,
               class [mscorlib]System.Security.Cryptography.CryptoStream V_1,
               class [mscorlib]System.Security.Cryptography.DESCryptoServiceProvider V_2,
               class [mscorlib]System.IO.MemoryStream V_3,
               class [mscorlib]System.IO.StreamWriter V_4)
      IL_0000:  nop
      IL_0001:  newobj     instance void [mscorlib]System.Security.Cryptography.DESCryptoServiceProvider::.ctor()
      IL_0006:  stloc.2
      IL_0007:  newobj     instance void [mscorlib]System.IO.MemoryStream::.ctor()
      IL_000c:  stloc.3
      IL_000d:  ldloc.3
      IL_000e:  ldloc.2
      IL_000f:  ldarg.0
      IL_0010:  ldfld      uint8[] PantoSchool.XT.Accounts.Business.DECEncrypt::arrDESKey
      IL_0015:  ldarg.0
      IL_0016:  ldfld      uint8[] PantoSchool.XT.Accounts.Business.DECEncrypt::arrDESIV
      IL_001b:  callvirt   instance class [mscorlib]System.Security.Cryptography.ICryptoTransform [mscorlib]System.Security.Cryptography.DESCryptoServiceProvider::CreateEncryptor(uint8[],
                                                                                                                                                                                   uint8[])
      IL_0020:  ldc.i4.1
      IL_0021:  newobj     instance void [mscorlib]System.Security.Cryptography.CryptoStream::.ctor(class [mscorlib]System.IO.Stream,
                                                                                                    class [mscorlib]System.Security.Cryptography.ICryptoTransform,
                                                                                                    valuetype [mscorlib]System.Security.Cryptography.CryptoStreamMode)
      IL_0026:  stloc.1
      IL_0027:  ldloc.1
      IL_0028:  newobj     instance void [mscorlib]System.IO.StreamWriter::.ctor(class [mscorlib]System.IO.Stream)
      IL_002d:  stloc.s    V_4
      IL_002f:  ldloc.s    V_4
      IL_0031:  ldarg.1
      IL_0032:  callvirt   instance void [mscorlib]System.IO.StreamWriter::Write(string)
      IL_0037:  nop
      IL_0038:  ldloc.s    V_4
      IL_003a:  callvirt   instance void [mscorlib]System.IO.StreamWriter::Flush()
      IL_003f:  nop
      IL_0040:  ldloc.1
      IL_0041:  callvirt   instance void [mscorlib]System.Security.Cryptography.CryptoStream::FlushFinalBlock()
      IL_0046:  nop
      IL_0047:  ldloc.3
      IL_0048:  callvirt   instance void [mscorlib]System.IO.MemoryStream::Flush()
      IL_004d:  nop
      IL_004e:  ldloc.3
      IL_004f:  callvirt   instance uint8[] [mscorlib]System.IO.MemoryStream::GetBuffer()
      IL_0054:  ldc.i4.0
      IL_0055:  ldloc.3
      IL_0056:  callvirt   instance int64 [mscorlib]System.IO.MemoryStream::get_Length()
      IL_005b:  conv.ovf.i4
      IL_005c:  call       string [mscorlib]System.Convert::ToBase64String(uint8[],
                                                                           int32,
                                                                           int32)
      IL_0061:  stloc.0
      IL_0062:  br.s       IL_0064
      IL_0064:  ldloc.0
      IL_0065:  ret
    } // end of method DECEncrypt::Encrypt
    怎么样能还原到原来的算法呢?怎么样能推出他的key和iv的值呢?
      

  4.   

    看那IL反编译的内容就知道应该不是md5再base64了,有key跟iv,明显是可逆的加密