2
Serginio1
05.08.20
✎
21:34
|
Функция ВычислитьHMAC(key,message)
врап=новый COMОбъект("NetObjectToIDispatch45");
encoding=Врап.ПолучитьТип("System.Text.Encoding").ASCII;
keyByte = encoding.GetBytes(key);
hmacmd5 = Врап.СоздатьОбъект("System.Security.Cryptography.HMACMD5",keyByte);
hmacsha1 = Врап.СоздатьОбъект("System.Security.Cryptography.HMACSHA1",keyByte);
messageBytes = encoding.GetBytes(message);
hashmessage = hmacmd5.ComputeHash(messageBytes);
hashmessage2 = hmacsha1.ComputeHash(messageBytes);
BitConverter=Врап.ПолучитьТип("System.BitConverter");
Strhashmessage=СтрЗаменить(BitConverter.ToString(hashmessage),"-","");
Strhashmessage2=СтрЗаменить(BitConverter.ToString(hashmessage2),"-","");
Сообщить(Strhashmessage);
Сообщить(Strhashmessage2);
КонецФункции // ВычислитьHMAC()
|
|