[SOLVED] DCPCrypt: dcpRipemd160 implementation. lazarus / 21-General ---------------------------------------------------------------------- torbente · 2021-01-11 21:05 I just discovered that dcpcrypt has this hash function and im tryong to implement it. Using this as guide: https://is.muni.cz/th/eyois/priloha/DCPcrypt/Docs/Hashes.html#Example1 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);  var    Hash: TDCP_ripemd160;  Digest: array[0..19] of byte;  // RipeMD-160 produces a 160bit digest (20bytes)    Source: TFileStream;    i: integer;    s: string;  begin    Source:= nil;    try      Source:= TFileStream.Create(Edit1.Text,fmOpenRead);  // open the file specified by Edit1    except      MessageDlg('Unable to open file',mtError,[mbOK],0);    end;    if Source <> nil then    begin    Hash:= TDCP_ripemd160.Create(Self);          // create the hash      Hash.Init;                                   // initialize it      Hash.UpdateStream(Source,Source.Size);       // hash the stream contents      Hash.Final(Digest);                          // produce the digest      Source.Free;      s:= '';      for i:= 0 to 19 do      s:= s + IntToHex(Digest[i],2);      Edit2.Text:= s;                            // display the digest    end;  end; Im trying to create a function to get the hash of string but im very far. function Getmd160(string):string; Anyone has been implemented this? ---------------------------------------------------------------------- torbente · 2021-01-11 22:29 Finally i found the correct way: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function HashMD160String(StringToHash:string):String;var  Hash: TDCP_ripemd160;  Digest: array[0..19] of byte;  Source: string;  i: integer;  str1: string;BeginSource:= StringToHash;if Source <> '' then   begin   Hash:= TDCP_ripemd160.Create(nil);   Hash.Init;   Hash.UpdateStr(Source);   Hash.Final(Digest);   str1:= '';   for i:= 0 to 19 do   str1:= str1 + IntToHex(Digest[i],2);   Result:=UpperCase(str1);   Hash.Free;   end;End;