WALTER | Workable Algorithms for Location-aware Transmission, Encryption Response

HashMethod Enumeration

Hashing method used in the string extension

Namespace:  System
Assembly:  Walter (in Walter.dll)

Syntax


public enum HashMethod

Members


Member nameDescription
SHA256 The SHA256 method will be used generating a 64 character hash
SHA384 The SHA256 method will be used generating a 96 character hash
SHA512 The SHA512 method will be used generating a 128 character hash
SHA1 The SHA1 method will be used generating a 40 character hash

Examples


You can generate a hash from a string by converting the string and taking a number of characters of the plain string obfiuscating the password source
Make a password from a string
var creditCard="4500-000-000-000";
   var password= creditCard.AsShaHash(HashMethod.SHA256, 8);
   var encryptionHelper = new Walter.SymmetricEncryption(password);

   var cypher= encryptionHelper.EncryptString(plain);
   if(string.IsNullOrEmpty(cypher))
   {
       throw new ApplicationException("Encryption generate null");
   }
   var copy= encryptionHelper.DecryptString(cypher);

   if(!string.Equals(plain, copy, StringComparison.Ordinal))
   {
       throw new Exception($"Plain {plain} and copy {copy} should be the same");
   }