add all
This commit is contained in:
55
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/crypto/engines/VMPCKSA3Engine.cs
vendored
Normal file
55
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/crypto/engines/VMPCKSA3Engine.cs
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
|
||||
{
|
||||
public class VmpcKsa3Engine
|
||||
: VmpcEngine
|
||||
{
|
||||
public override string AlgorithmName
|
||||
{
|
||||
get { return "VMPC-KSA3"; }
|
||||
}
|
||||
|
||||
protected override void InitKey(
|
||||
byte[] keyBytes,
|
||||
byte[] ivBytes)
|
||||
{
|
||||
s = 0;
|
||||
P = new byte[256];
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
P[i] = (byte) i;
|
||||
}
|
||||
|
||||
for (int m = 0; m < 768; m++)
|
||||
{
|
||||
s = P[(s + P[m & 0xff] + keyBytes[m % keyBytes.Length]) & 0xff];
|
||||
byte temp = P[m & 0xff];
|
||||
P[m & 0xff] = P[s & 0xff];
|
||||
P[s & 0xff] = temp;
|
||||
}
|
||||
|
||||
for (int m = 0; m < 768; m++)
|
||||
{
|
||||
s = P[(s + P[m & 0xff] + ivBytes[m % ivBytes.Length]) & 0xff];
|
||||
byte temp = P[m & 0xff];
|
||||
P[m & 0xff] = P[s & 0xff];
|
||||
P[s & 0xff] = temp;
|
||||
}
|
||||
|
||||
for (int m = 0; m < 768; m++)
|
||||
{
|
||||
s = P[(s + P[m & 0xff] + keyBytes[m % keyBytes.Length]) & 0xff];
|
||||
byte temp = P[m & 0xff];
|
||||
P[m & 0xff] = P[s & 0xff];
|
||||
P[s & 0xff] = temp;
|
||||
}
|
||||
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
Reference in New Issue
Block a user