4. Juni 2013 08:30
4. Juni 2013 08:34
4. Juni 2013 16:18
4. Juni 2013 21:57
OBJECT Codeunit 50000 Calculate Hash
{
OBJECT-PROPERTIES
{
Date=04.06.13;
Time=21:49:55;
Modified=Yes;
Version List=;
}
PROPERTIES
{
OnRun=VAR
SHA1Hash@1000000000 : Text;
MD5Hash@1000000001 : Text;
BEGIN
SHA1Hash := GetSHA1('D:\Temp\File1.txt');
MD5Hash := GetMD5('D:\Temp\File1.txt');
MESSAGE('SHA1: ' + SHA1Hash + ', MD5: ' + MD5Hash);
END;
}
CODE
{
PROCEDURE GetSHA1@1000000004(Filename@1000000000 : Text) : Text;
VAR
SHA1CryptoServiceProvider@1000000002 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Security.Cryptography.SHA1CryptoServiceProvider";
BEGIN
SHA1CryptoServiceProvider := SHA1CryptoServiceProvider.SHA1CryptoServiceProvider();
EXIT(GetHashString(Filename,SHA1CryptoServiceProvider));
END;
PROCEDURE GetMD5@1000000000(Filename@1000000000 : Text) : Text;
VAR
MD5CryptoServiceProvider@1000000002 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Security.Cryptography.MD5CryptoServiceProvider";
BEGIN
MD5CryptoServiceProvider := MD5CryptoServiceProvider.MD5CryptoServiceProvider();
EXIT(GetHashString(Filename,MD5CryptoServiceProvider));
END;
PROCEDURE GetFileStream@1000000001(Filename@1000000000 : Text;VAR ReturnFileStream@1000000001 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.IO.FileStream") : Boolean;
VAR
FileMode@1000000002 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.IO.FileMode";
BEGIN
ReturnFileStream := ReturnFileStream.FileStream(Filename,FileMode.Open);
IF NOT ISNULL(ReturnFileStream) THEN
EXIT(TRUE);
EXIT(FALSE);
END;
PROCEDURE GetHashString@1000000002(Filename@1000000001 : Text;HashAlgorithm@1000000000 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Security.Cryptography.HashAlgorithm") : Text;
VAR
FileStream@1000000005 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.IO.FileStream";
BitConverter@1000000004 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.BitConverter";
HashString@1000000003 : DotNet "'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.String";
ReturnHash@1000000002 : Text;
BEGIN
IF NOT GetFileStream(Filename,FileStream) THEN
EXIT('');
HashString := BitConverter.ToString(HashAlgorithm.ComputeHash(FileStream));
ReturnHash := HashString.Replace('-','');
FileStream.Close();
EXIT(ReturnHash);
END;
BEGIN
END.
}
}
5. Juni 2013 11:16
3. Februar 2015 09:24
3. Februar 2015 11:03
5. Februar 2015 13:15
19. Februar 2015 01:11
22. Januar 2018 17:10
24. Januar 2018 15:04
RecRef1.GETTABLE(Rec1);
RecRef2.GETTABLE(Rec2);
IF FORMAT(RecRef1) <> FORMAT(RecRef2) THEN BEGIN
[...]
END;
24. Januar 2018 16:22
21. April 2020 12:54