read a hash lazarus / 9-Editor ---------------------------------------------------------------------- emil · 2015-03-14 22:34 hello guys im begginer i want to hash a string: s := MD5Print(MD5String('hei'); after, i want to get the value 'hei' using S it is possible? i need to hash a fille, i want to make it unreadable ---------------------------------------------------------------------- engkin · 2015-03-14 23:31 Quote from: emil on March 14, 2015, 11:34:52 pmhello guys im begginer i want to hash a string: s := MD5Print(MD5String('hei'); after, i want to get the value 'hei' using S it is possible? No, it is not possible. In general, you can *not* get the original string from a hash. Moreover, two different strings could have the same hash code. MD5 hashing gives 16 bytes (32 hex digits) regardless of the string. Quote from: emil on March 14, 2015, 11:34:52 pmi need to hash a fille, i want to make it unreadable Simplest way is to use xor: Code: [Select]var   s: string;   i: Integer; begin   s := 'Apples';   //Encode   for i := 1 to Length(s) do     s[i] := Char(Byte(s[i]) xor $67);   WriteLn(s);   //Decode   for i := 1 to Length(s) do     s[i] := Char(Byte(s[i]) xor $67);   WriteLn(s); $67 is just an example, use a number of your own. For a bit better way that produces "readable" text, use Base64 encoding from unit base64: Code: [Select]program Project1; uses   base64; var   s: string; begin   s := 'Apples';   //Encode   s := EncodeStringBase64(s);   WriteLn(s);   //Decode   s := DecodeStringBase64(s);   WriteLn(s);   ReadLn; end. Both are not secure. For a bit of security try BlowFish, for instance. Here is a nice example by ChrisF. ---------------------------------------------------------------------- Leledumbo · 2015-03-15 05:11 Quote from: emil on March 14, 2015, 11:34:52 pmit is possible? No, hash is one way, you can't retrieve back the original string having only the hash. Quote from: emil on March 14, 2015, 11:34:52 pmi need to hash a fille, i want to make it unreadable Use encryption, not hash.