Answer the question
In order to leave comments, you need to log in
How to encrypt a request to the Instagram API with the SHA256 algorithm in Delphi?
Good afternoon everyone!
Understanding the Instagram API. There, the hash of the request itself, calculated using the secret key, must be added to the requests. There are examples for python, ruby and PHP. They all use libraries or built-in functions.
I need to write a function or find a library for Delphi, but so far nothing. I really hope for general help.
Answer the question
In order to leave comments, you need to log in
Thank you all for the witty replies! I found! Now I'm sharing with the world - suddenly someone will come in handy?
uses Hash, HMAC, HMACSHA2, Mem_Util
{...}
function HMAC_SHA256(AKey, AStr: AnsiString): String;
var
ctx: THMAC_Context;
mac: TSHA256Digest;
begin
hmac_SHA256_init(ctx, @AKey[1], Length(AKey));
hmac_SHA256_update(ctx, @AStr[1], Length(AStr));
hmac_SHA256_final(ctx, mac);
Result:=HexStr(@mac, SizeOf(TSHA256Digest));
end;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question