Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
31
Task/SHA-256/Delphi/sha-256.delphi
Normal file
31
Task/SHA-256/Delphi/sha-256.delphi
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
program SHA_256;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
uses
|
||||
System.SysUtils,
|
||||
DCPsha256;
|
||||
|
||||
function SHA256(const Str: string): string;
|
||||
var
|
||||
HashDigest: array of byte;
|
||||
d: Byte;
|
||||
begin
|
||||
Result := '';
|
||||
with TDCP_sha256.Create(nil) do
|
||||
begin
|
||||
Init;
|
||||
UpdateStr(Str);
|
||||
SetLength(HashDigest, GetHashSize div 8);
|
||||
final(HashDigest[0]);
|
||||
for d in HashDigest do
|
||||
Result := Result + d.ToHexString(2);
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
Writeln(SHA256('Rosetta code'));
|
||||
readln;
|
||||
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue