public static byte[] csHashBytes(string Message) { byte[] MessageBytes = TCipher.RegularStringToBytes(Message); SHA1 sha = new SHA1CryptoServiceProvider(); return(sha.ComputeHash(MessageBytes)); }
public static string csGetLayout(this GridView gv) { MemoryStream ms = new MemoryStream(); gv.SaveLayoutToStream(ms); var b = ms.ToArray(); return(TCipher.BytesToBase64String(b)); }
public static string EncryptStringToBase64(string Value, string key) { if (string.IsNullOrEmpty(Value) || string.IsNullOrEmpty(key)) { return(string.Empty); } byte[] keyb = Parameter(key); byte[] cypher = TCipher.encryptStringToBytes_AES(Value, keyb); return(BytesToBase64String(cypher)); }
public static void csSetLayout(this GridView gv, string s64) { if (string.IsNullOrEmpty(s64)) { return; } byte[] b = TCipher.Base64toBytes(s64); MemoryStream ms = new MemoryStream(b); gv.RestoreLayoutFromStream(ms); }
public static string DotKey(string UserID, string UserName, string Password) { string s = UserID + Password + UserName + Password; while (s.Contains(" ")) { int i = s.IndexOf(' '); s = s.Remove(i, 1); } s = s.ToUpper(); return(IntToDotted(TCipher.csHashint32(s))); }
private static int ProcessInput(string s) { while (s.Contains(" ")) { int i = s.IndexOf(' '); s = s.Remove(i, 1); } s = s.ToUpper(); int v = TCipher.csHashint32(s); return(v); }
public static string GetWindowsValidationCode(string uid, string key) { string domain = Environment.UserDomainName; StringBuilder sb = new StringBuilder(key); sb.Append(uid); sb.Append(key); sb.Append(domain); sb.Append(key); sb.Append(domain); sb.Append(uid); sb.Append(key); string s = TCipher.SliceAndDice(sb.ToString()); return(TCipher.PrintableString(s)); }
public static string DecryptString(string Value64, string Password) { if (string.IsNullOrEmpty(Value64) || string.IsNullOrEmpty(Password)) { return(string.Empty); } try { byte[] key = Parameter(Password); byte[] cypher = TCipher.Base64toBytes(Value64); return(decryptStringFromBytes_AES(cypher, key)); } catch { #if (DEBUG) { throw new Exception("Invalid Operation"); } #else { return(string.Empty); } #endif } }
public static int csHashint32(this string MessageString) // Secure hash { if (MessageString == null) { return(0); } //convert the string into an array of Unicode bytes. byte[] MessageBytes = TCipher.RegularStringToBytes(MessageString); //Create a new instance of the SHA1Managed class to create //the hash value. SHA1Managed SHhash = new SHA1Managed(); //Create the hash value from the array of bytes. byte[] HashValue = SHhash.ComputeHash(MessageBytes); int v = 0; for (int i = 6; i < 10; i++) { byte b = HashValue[i]; v = (v << 8) + HashValue[i]; } return(v); }
public static int GetPassword(string p, string key) { return(TCipher.csHashint32(TCipher.SliceAndDice(p + key))); }
//public static string RSAEncrypt(string PlainText, string Key) //{ // byte[] plainBytes = TCipher.RegularStringToBytes(PlainText); // return TCipher.BytesToRegularString(RSAEncrypt(plainBytes, Key)); //} public static string RSAEncryptToBase64(string PlainText, string Key) { byte[] plainBytes = TCipher.RegularStringToBytes(PlainText); return(TCipher.BytesToBase64String(RSAEncrypt(plainBytes, Key))); }
public static string RSADecrypt(string Base64CipherText, string Key) { byte[] bEncryptedText = TCipher.Base64toBytes(Base64CipherText); byte[] bPlainText = TCipher.RSADecrypt(bEncryptedText, Key); return(BytesToRegularString(bPlainText)); }
public static string PrintableString(string Message) { return(TCipher.StringToBase64(Message)); }
public bool Validate(string password) { return(KEY == TCipher.GenerateTumbler(USERID, NAME, password)); }
public TReEventTypetration(string Userid_HEX, string Key_DD, string Name) { USERID = MyLib.HexToInt(Userid_HEX); KEY = TCipher.DottedToInt(Key_DD); NAME = Name; }