示例#1
0
 public virtual string Decrypt(string base64Text)
 {
     if (!this._encryptionOptions.Encrypt)
     {
         return(base64Text);
     }
     return(CryptographyUtils.Decrypt(this._algorithm, base64Text, this._encryptionOptions.InternalKey));
 }
示例#2
0
 public virtual string Encrypt(string plaintext)
 {
     if (!this._encryptionOptions.Encrypt)
     {
         return(plaintext);
     }
     return(CryptographyUtils.Encrypt(this._algorithm, plaintext, this._encryptionOptions.InternalKey));
 }
示例#3
0
 public string Encrypt(string plaintext)
 {
     if (!this._encryptionOptions.Encrypt)
     {
         return(plaintext);
     }
     return(CryptographyUtils.Encrypt(this._algorithm, plaintext));
 }
示例#4
0
        public static bool IsHashMatch(HashAlgorithm hashAlgorithm, string hashedText, string unhashedText)
        {
            string strB = CryptographyUtils.Encrypt(hashAlgorithm, unhashedText);

            return(string.Compare(hashedText, strB, false) == 0);
        }
示例#5
0
 public CryptoSym(string key)
 {
     this._encryptionOptions = new CryptoConfig(true, key);
     this._algorithm         = CryptographyUtils.CreateSymmAlgoTripleDes();
 }
示例#6
0
 public CryptoHash()
 {
     this._encryptionOptions = new CryptoConfig();
     this._algorithm         = CryptographyUtils.CreateHashAlgoMd5();
 }