You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
923 B
50 lines
923 B
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR) |
|
#pragma warning disable |
|
using System; |
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Bcpg |
|
{ |
|
public class Crc24 |
|
{ |
|
private const int Crc24Init = 0x0b704ce; |
|
private const int Crc24Poly = 0x1864cfb; |
|
|
|
private int crc = Crc24Init; |
|
|
|
public Crc24() |
|
{ |
|
} |
|
|
|
public void Update( |
|
int b) |
|
{ |
|
crc ^= b << 16; |
|
for (int i = 0; i < 8; i++) |
|
{ |
|
crc <<= 1; |
|
if ((crc & 0x1000000) != 0) |
|
{ |
|
crc ^= Crc24Poly; |
|
} |
|
} |
|
} |
|
|
|
|
|
public int GetValue() |
|
{ |
|
return crc; |
|
} |
|
|
|
public int Value |
|
{ |
|
get { return crc; } |
|
} |
|
|
|
public void Reset() |
|
{ |
|
crc = Crc24Init; |
|
} |
|
} |
|
} |
|
#pragma warning restore |
|
#endif
|
|
|