当前位置: 首页 > wzjs >正文

如何在百度做网站推广html5网站开发价格

如何在百度做网站推广,html5网站开发价格,国外免费服务器地址,什么是静态网页1. 前言 今天做一个三方接口,接口文档描述签名采用MD5,但是实际测试过程中,始终校验不通过,经过和三方沟通,才知道采用的是HMAC-MD5。由于Delphi7没有对HMAC的支持,则采用XE版本来支持。本次使用Delphi XE …

1. 前言

        今天做一个三方接口,接口文档描述签名采用MD5,但是实际测试过程中,始终校验不通过,经过和三方沟通,才知道采用的是HMAC-MD5。由于Delphi7没有对HMAC的支持,则采用XE版本来支持。本次使用Delphi XE 10.3.3、Delphi 7来实现。

        HMAC 散列消息认证码 (Hash-based Message Authentication Code),它是一种基于加密哈希函数和共享密钥的消息认证协议。它是一种给消息加上数字签名的方法,这个签名是根据消息内容和一个共享密钥生成的,只有知道密钥的人才能生成或验证这个签名。
        HMAC - https://baike.baidu.com/item/hmac/7307543
        在线验证 https://www.btool.cn/hmac-generator

2. Delphi XE 10.3.3 实现动态库

2.1 工程文件 hmactool.dpr

library hmactool;{HMAC 散列消息认证码 (Hash-based Message Authentication Code)它是一种基于加密哈希函数和共享密钥的消息认证协议。它是一种给消息加上数字签名的方法,这个签名是根据消息内容和一个共享密钥生成的,只有知道密钥的人才能生成或验证这个签名。HMAC - https://baike.baidu.com/item/hmac/7307543在线验证 https://www.btool.cn/hmac-generator
}usesWinapi.Windows,System.SysUtils,System.Classes,InterfaceDll in 'InterfaceDll.pas';{$R *.res}exportsdll_hmac_md5,dll_hmac_sha1,dll_hmac_sha2;procedure DLLHandler(Reason: integer);
varbuf: array[0..1023] of char;
begincase Reason ofDLL_PROCESS_DETACH: //释放DLL时beginend;DLL_Process_Attach: //加载DLL时beginend;DLL_Thread_Attach: //主进程创建一个新线程时beginend;DLL_Thread_Detach: //主进程结束一个线程时beginend;end;
end;beginDLLProc := @DLLHandler;DLLHandler(DLL_Process_Attach);
end.

2.2 接口文件 InterfaceDll.pas

unit InterfaceDll;interfaceusesSystem.SysUtils, System.Hash;varErrInfo: WideString;function dll_hmac_md5(sIn, sKey: PWideChar; var sOut: PWideChar): Byte; stdcall;function dll_hmac_sha1(sIn, sKey: PWideChar; var sOut: PWideChar): Byte; stdcall;function dll_hmac_sha2(iType: Byte; sIn, sKey: PWideChar; var sOut: PWideChar): Byte; stdcall;implementationfunction dll_hmac_md5(sIn, sKey: PWideChar; var sOut: PWideChar): Byte; stdcall;
varKey, Data: WideString;Hash: THashMD5;HMAC: WideString;
beginData := Trim(sIn);Key:= Trim(sKey);Hash := THashMD5.Create;HMAC := Hash.GetHMAC(Data, Key);sOut:= PWideChar(HMAC);result:= 0;
end;function dll_hmac_sha1(sIn, sKey: PWideChar; var sOut: PWideChar): Byte; stdcall;
varKey, Data: WideString;Hash: THashSHA1;HMAC: WideString;
beginData := Trim(sIn);Key:= Trim(sKey);Hash := THashSHA1.Create;HMAC := Hash.GetHMAC(Data, Key);sOut:= PWideChar(HMAC);result:= 0;
end;function dll_hmac_sha2(iType: Byte; sIn, sKey: PWideChar; var sOut: PWideChar): Byte; stdcall;
varKey, Data: WideString;Hash: THashSHA2;HMAC: WideString;
beginData := Trim(sIn);Key:= Trim(sKey);Hash := THashSHA2.Create(THashSHA2.TSHA2Version(iType));HMAC := Hash.GetHMAC(Data, Key, THashSHA2.TSHA2Version(iType));sOut:= PWideChar(HMAC);result:= 0;
end;end.

3. Delphi 7 实现Demo

3.1 工程文件 D7Demo.dpr

program D7Demo;usesForms,uDemo in 'uDemo.pas' {FrmMain};{$R *.res}beginApplication.Initialize;Application.CreateForm(TFrmMain, FrmMain);Application.Run;
end.

3.2 窗体代码 uDemo.pas

unit uDemo;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls, ComCtrls;constdllname= 'hmactool.dll';typeTFrmMain = class(TForm)redt1: TRichEdit;btn1: TButton;edt1: TEdit;edt2: TEdit;lbl1: TLabel;lbl2: TLabel;lbl3: TLabel;btn2: TButton;grp1: TGroupBox;btn3: TButton;rb1: TRadioButton;rb2: TRadioButton;rb3: TRadioButton;rb4: TRadioButton;rb5: TRadioButton;rb6: TRadioButton;procedure btn1Click(Sender: TObject);procedure btn2Click(Sender: TObject);procedure btn3Click(Sender: TObject);private{ Private declarations }public{ Public declarations }end;function dll_hmac_md5(pIn, pKey: PWideChar; var pOut: PWideChar): Byte; stdcall; external dllname;function dll_hmac_sha1(sIn, sKey: PWideChar; var sOut: PWideChar): Byte; stdcall; external dllname;function dll_hmac_sha2(iType: Byte; sIn, sKey: PWideChar; var sOut: PWideChar): Byte; stdcall; external dllname;varFrmMain: TFrmMain;implementation{$R *.dfm}procedure TFrmMain.btn1Click(Sender: TObject);
varsIn, sKey, sOut: WideString;pOut: PWideChar;iRet: Byte;
beginsIn:= StringReplace(Trim(redt1.Lines.Text),#13#10,'',[rfReplaceAll,rfIgnoreCase]);sKey:= Trim(edt2.Text);iRet:= dll_hmac_md5(PWideChar(sIn), PWideChar(sKey), pOut);if (iRet= 0) thenbeginedt1.Text:= UTF8Decode(pOut);end;
end;procedure TFrmMain.btn2Click(Sender: TObject);
varsIn, sKey, sOut: WideString;pOut: PWideChar;iRet: Byte;
beginsIn:= StringReplace(Trim(redt1.Lines.Text),#13#10,'',[rfReplaceAll,rfIgnoreCase]);sKey:= Trim(edt2.Text);iRet:= dll_hmac_sha1(PWideChar(sIn), PWideChar(sKey), pOut);if (iRet= 0) thenbeginedt1.Text:= UTF8Decode(pOut);end;
end;procedure TFrmMain.btn3Click(Sender: TObject);
varsIn, sKey, sOut: WideString;pOut: PWideChar;iType, iRet: Byte;
beginif rb1.Checked theniType:= 0else if rb2.Checked theniType:= 1else if rb3.Checked theniType:= 2else if rb4.Checked theniType:= 3else if rb5.Checked theniType:= 4else if rb6.Checked theniType:= 5;sIn:= StringReplace(Trim(redt1.Lines.Text),#13#10,'',[rfReplaceAll,rfIgnoreCase]);sKey:= Trim(edt2.Text);iRet:= dll_hmac_sha2(iType, PWideChar(sIn), PWideChar(sKey), pOut);if (iRet= 0) thenbeginedt1.Text:= UTF8Decode(pOut);end;
end;end.

4. 最终效果

        测试了MD5、SHA1、SHA224、SHA256、SHA384、SHA512、SHA512-224、SHA512-256都可行,以下就贴出其中三个效果图吧,其他就不贴了。


文章转载自:

http://KZuo1oqr.gwbfx.cn
http://mgVSY45p.gwbfx.cn
http://JjTWbqso.gwbfx.cn
http://ULThjHhQ.gwbfx.cn
http://du3lfG16.gwbfx.cn
http://EQ407HLC.gwbfx.cn
http://khjKVIiO.gwbfx.cn
http://Ww9EgxhW.gwbfx.cn
http://XHiVRid6.gwbfx.cn
http://pQ9ToP0x.gwbfx.cn
http://hiff0BUx.gwbfx.cn
http://b7w7ghfI.gwbfx.cn
http://qsCzx4wo.gwbfx.cn
http://PTDkTCR9.gwbfx.cn
http://ovKi6Ieh.gwbfx.cn
http://OVyo5yRn.gwbfx.cn
http://Xq6Hz8EG.gwbfx.cn
http://H60UaKY0.gwbfx.cn
http://JU608IbQ.gwbfx.cn
http://joSt0nQM.gwbfx.cn
http://p4BqBmJ8.gwbfx.cn
http://3pVrvHng.gwbfx.cn
http://7DteE5b6.gwbfx.cn
http://nQaLzDAi.gwbfx.cn
http://K8vRP7S7.gwbfx.cn
http://3RPOrOQ3.gwbfx.cn
http://z0GkwjCp.gwbfx.cn
http://iGXvAPp5.gwbfx.cn
http://e7lBQWtT.gwbfx.cn
http://fSBMxHOj.gwbfx.cn
http://www.dtcms.com/wzjs/646444.html

相关文章:

  • 建设网站服务器目前主流网站开发所用软件
  • 制作网站流程深圳公司网站搭建公司
  • 小公司做网站需要代码html
  • 网站首页设计多少钱郑州网络推广哪家厉害
  • 建立网站最先进的互联网技术有哪些抖音代运营话术
  • pc网站做移动适配做网站jsp和php
  • 谷歌网站建设开发公司起名大全
  • 厦门市建设局查询保障摇号网站首页深圳专业手机网站建设
  • 旅游网站制作内容珠海做网站推广公司
  • 建立一个网站赚钱了手车做网课网站
  • 做苗木的用什么网站cdn wordpress 统计
  • 钓鱼网站教程技术博客wordpress主题
  • 做app的模板下载网站有哪些内容长春电商网站建设
  • 石家庄做网站排名公司在北京注册公司要哪些条件
  • 闵行营销型网站建设公司百度收录需要多久
  • 淘宝客手机网站搭建前端开发可以做网站赚钱吗
  • qt做网站服务器四川建设厅网站招聘
  • 西安 网站建设wordpress小程序收录
  • 南宁网站建设专业品牌软文发布软件
  • 给企业做网站如何定价新手销售怎么和客户交流
  • 公司建设网站价格表上海人才网官网招聘人力资源专业
  • 网站关键字怎么修改足球比赛直播网
  • 郑州高端建站网站建设专业知识应用
  • 成都建站网络营销专业建议
  • 在线解析网站国内新闻最近新闻今天
  • 毕业设计做网站怎样的工作量算达标网站推广朋友圈文案
  • 优秀网站特点Wordpress主题 仿魅族
  • 重庆中色十二冶金建设有限公司网站网上创建公司
  • 网站平台建设是什么什么叫网站集约化建设
  • 绵阳网站建设制作电子商务网站规划书