mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +00:00
Update HIGHT.cs
This commit is contained in:
parent
436ce3d88d
commit
7d01adb54b
|
@ -128,6 +128,21 @@ namespace WelsonJS.Cryptography
|
|||
byte[] scheduleKey = new byte[136];
|
||||
public ECB(byte[] userKey)
|
||||
{
|
||||
if (userKey.Length < 16)
|
||||
{
|
||||
// Pad the key with 0x00 if its length is less than 16 bytes
|
||||
byte[] paddedKey = new byte[16];
|
||||
Array.Copy(userKey, 0, paddedKey, 0, userKey.Length);
|
||||
userKey = paddedKey;
|
||||
}
|
||||
else if (userKey.Length > 16)
|
||||
{
|
||||
// If the key is longer than 16 bytes, truncate to 16 bytes
|
||||
byte[] truncatedKey = new byte[16];
|
||||
Array.Copy(userKey, truncatedKey, 16);
|
||||
userKey = truncatedKey;
|
||||
}
|
||||
|
||||
KeySched(userKey);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user