Delphi HMACSHA256


本文整理自网络,侵删。

 
uses
  IdGlobal, IdHashSHA, IdHMAC, IdHMACSHA1, IdSSLOpenSSL;

function CalculateHMACSHA256(const value, salt: String): String;
var
  hmac: TIdHMACSHA256;
  hash: TIdBytes;
begin
  LoadOpenSSLLibrary;
  if not TIdHashSHA256.IsAvailable then
    raise Exception.Create('SHA256 hashing is not available!');
  hmac := TIdHMACSHA256.Create;
  try
    hmac.Key := IndyTextEncoding_UTF8.GetBytes(salt);
    hash := hmac.HashValue(IndyTextEncoding_UTF8.GetBytes(value));
    Result := ToHex(hash);
  finally
    hmac.Free;
  end;
end;

程序目录下必备文件:
libeay32.dll

ssleay32.dll


了解更多:https://stackoverflow.com/questions/2003194/hmac-sha256-in-delphi

相关阅读 >>

Delphi 读cpu串号的代码

Delphi 各种tstream(流)介绍

Delphi 如何使用程序标识符检查程序是否已安装

Delphi webbrowser有关技术

Delphi sizetostr 文件大小转换kb mb gb tb

Delphi中利用中断获得系统启动以来的时间

Delphi xe6 android 查看电池信息

Delphi检测网络连接状态

Delphi 检测url地址是否有效

Delphi stringgrid 加载excel表格文件内容自动宽度

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...

    正在狠努力加载,请稍候...