Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1501
  • Last Modified:

I want to know how to use DCPCrypt v2

I do not know anything about encryption...

i have this function:
--------------------------------------------------------------------------------------------
function getDigest(str:string):ansiString;
var
  Hash  : TDCP_sha256;
  Digest: array[0..31] of byte;
  i: integer;
  s: ansiString;
begin


  s:= '';

  hash  := TDCP_sha256.Create(nil);
  if hash<>nil then
  begin
    try

      Hash.Init;                 // initialize it
      Hash.UpdateStr(str);       // hash the stream contents
      Hash.Final(Digest);        // produce the digest


      for i:= 0 to length(Digest)-1 do
        s:= s + IntToHex(Digest[i],2);

    finally
      hash.free;
    end;

  end;
  result  :=  s;
end;
--------------------------------------------------------------------------------------------------------------
which returns me a hash string to store in a table/database.
actually it works very good in 256 bits, i think so, but i want to upgrade my function to 512 bits.
how can i do that please??
0
alexinoa
Asked:
alexinoa
1 Solution
 
MerijnBSr. Software EngineerCommented:
function getDigest(str:string):ansiString;
var
  Hash  : TDCP_sha512;
  Digest: array[0..63] of byte;
  i: integer;
  s: ansiString;
begin


  s:= '';

  hash  := TDCP_sha512.Create(nil);
  if hash<>nil then
  begin
    try

      Hash.Init;                 // initialize it
      Hash.UpdateStr(str);       // hash the stream contents
      Hash.Final(Digest);        // produce the digest


      for i:= 0 to length(Digest)-1 do
        s:= s + IntToHex(Digest[i],2);

    finally
      hash.free;
    end;

  end;
  result  :=  s;
end;
---------
0

Featured Post

Automating Your MSP Business

The road to profitability.
Delivering superior services is key to ensuring customer satisfaction and the consequent long-term relationships that enable MSPs to lock in predictable, recurring revenue. What's the best way to deliver superior service? One word: automation.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now