为什么TIdHMACSHA256 +(Indy/delphi)的HashValue函数总是返回空?例如,下面的代码不起作用.
var
Hash: TIdHMACSHA256 ;
HashValue: TBytes;
begin
SetCurrentDir(ExtractFilePath(ParamStr(0)));
Hash := TIdHMACSHA256 .Create;
try
Hash.Key := TEncoding.ASCII.GetBytes('devaee2');
HashValue := Hash.HashValue(TFile.ReadAllBytes('menu.xml'));
// HashValue is an empty array, why?
Tag := Length(HashValue);
TFile.WriteAllBytes('menu.xml.hash', HashValue);
finally
FreeAndNil(Hash);
end;
end;
Run Code Online (Sandbox Code Playgroud) typescriptlang.org [ https://www.typescriptlang.org/play/index.html]的编辑是优质的.但我找不到下面的页面中使用的编辑器.
你喜欢这样的优秀打字稿吗?
我的 PHP 代码可以发送两个具有相同名称的标头,在 php 中第二个参数用于替换或覆盖。但在 ExpressJS res.header中不像 php 代码 PHP 代码:
header("Link: <http://$prefetch_next_img>; rel=prefetch",false);
header("Link: <http://$prefetch_next_img2>; rel=prefetch",false);
Run Code Online (Sandbox Code Playgroud)
http://us2.php.net/manual/en/function.header.php
ExpressJS(NodeJS) :
res.header('Link','Fake Value');
res.header('Link','Only Send it'); // previous header replaced
Run Code Online (Sandbox Code Playgroud) 我有一个微观优化问题。我有 3 种处理 typed-Pointer(array) 的方法。哪一个更好?
for I:=0 to ArrCount-1 do
begin // I:Var is unused in below-block
Inc(P) ; // P is typed-Pointer
// do somethings
end;
Run Code Online (Sandbox Code Playgroud)
for I:=ArrCount-1 downto 0 do
begin // I:Var is unused in below-block
Inc(P) ; // P is typed-Pointer
// do somethings
end;
Run Code Online (Sandbox Code Playgroud)
While ArrCount>0 do
begin
Inc(P) ; // P is typed-Pointer
// do somethings
Dec(ArrCount);
end;
Run Code Online (Sandbox Code Playgroud)