This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.Globalization; | |
using System.Numerics; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
[DebuggerDisplay("{" + nameof(DDisplay) + "}")] | |
[Serializable] | |
public struct BigRational : IComparable, IComparable<BigRational>, IEquatable<BigRational> | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SecureStringHelper : IDisposable | |
{ | |
private readonly Encoding _encoding; | |
private readonly SecureString _secureString; | |
private byte[] _bytes; | |
private bool _disposed; | |
public SecureStringHelper(SecureString secureString) : this(secureString, Encoding.Default) | |
{ | |
} | |
public SecureStringHelper(SecureString secureString, Encoding encoding) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Diagnostics; | |
using System.Globalization; | |
using System.Numerics; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
[Serializable] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Security.Cryptography; | |
public class Mapping256BitTo32BitHash : HashAlgorithm | |
{ | |
private readonly SHA256Managed hasher = new SHA256Managed(); | |
public readonly TinyDictionary<byte[], byte[]> map = new TinyDictionary<byte[], byte[]>(101, new ArrayComparer()); | |
private byte[] h160; | |
public override int HashSize => 32; | |
public override void Initialize() | |
{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Reflection; | |
using System.Runtime.Serialization.Formatters.Binary; | |
using System.Security; | |
[Serializable] | |
public class MapComparer<T> : IEqualityComparer<T> | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
public class MonitorActionFuncWrapper : ConcurrencyCheck | |
{ | |
public void Lock(object localObject, Action action) | |
{ | |
if (action == null) | |
throw new Exception("Action argument cannot be null"); | |
if (CheckState()) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Security.Cryptography; | |
[Serializable] | |
public class Sha16512 : HashAlgorithm | |
{ | |
private int _bitWidth; | |
private SHA512Managed _hash = new SHA512Managed(); | |
public Sha16512(int bitWidth) | |
{ | |
if (bitWidth < 16 || bitWidth > 512) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Numerics; | |
using System.Reflection; | |
using System.Runtime.InteropServices; | |
using System.Runtime.Serialization.Formatters.Binary; | |
using System.Security; | |
using System.Security.Cryptography; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Numerics; | |
using System.Security.Cryptography; | |
public class FNV1a128b : HashAlgorithm | |
{ | |
private readonly BigInteger K = "309485009821345068724781371".BigIntegerBase10(); | |
private readonly BigInteger M = "340282366920938463463374607431768211456".BigIntegerBase10(); | |
private BigInteger _hash; | |
private readonly BigInteger Seed = "144066263297769815596495629667062367629".BigIntegerBase10(); | |
public FNV1a128b() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Numerics; | |
using System.Security.Cryptography; | |
public struct RandomX | |
{ | |
private readonly RNGCryptoServiceProvider _crng; | |
private int _maxByteWidth; | |
private int _bitWidth; | |
public RandomX(int bitWidth) | |
{ |