54 lines
1.2 KiB
C#
54 lines
1.2 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: Rei.Fs.Adler32
|
|
// Assembly: Rei.Fs, Version=1.13.2.8796, Culture=neutral, PublicKeyToken=null
|
|
// MVID: D8B08A8B-697C-4439-9CFF-1BE4EE46F7B0
|
|
// Assembly location: F:\Eigene Dateien\Dropbox\portable Collection\Progs\CarotDAV\Rei.Fs.dll
|
|
|
|
namespace Rei.Fs
|
|
{
|
|
public class Adler32
|
|
{
|
|
private int m_s1;
|
|
private int m_s2;
|
|
private const int modulo = 65521;
|
|
|
|
public byte[] Value
|
|
{
|
|
get
|
|
{
|
|
return new byte[4]
|
|
{
|
|
checked ((byte) (this.m_s2 >> 8)),
|
|
checked ((byte) (this.m_s2 & (int) byte.MaxValue)),
|
|
checked ((byte) (this.m_s1 >> 8)),
|
|
checked ((byte) (this.m_s1 & (int) byte.MaxValue))
|
|
};
|
|
}
|
|
}
|
|
|
|
public Adler32()
|
|
{
|
|
this.m_s1 = 1;
|
|
this.m_s2 = 0;
|
|
}
|
|
|
|
public void Calc(byte[] buf)
|
|
{
|
|
this.Calc(buf, 0, buf.Length);
|
|
}
|
|
|
|
public void Calc(byte[] buf, int index, int length)
|
|
{
|
|
int num1 = index;
|
|
int num2 = checked (index + length - 1);
|
|
int index1 = num1;
|
|
while (index1 <= num2)
|
|
{
|
|
this.m_s1 = checked (this.m_s1 + (int) buf[index1]) % 65521;
|
|
this.m_s2 = checked (this.m_s2 + this.m_s1) % 65521;
|
|
checked { ++index1; }
|
|
}
|
|
}
|
|
}
|
|
}
|