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; | |
public class FixedBigIntegerRandomNumberGenerator : RandomNumberGenerator | |
{ | |
private readonly int _bitWidthHold; | |
private readonly byte[] _buffer; | |
private readonly BigDecimal _dBi; | |
private readonly FixedBigInteger _maxValueHold = new FixedBigInteger(0, 0); | |
private readonly JitterCacheRng _crng; | |
public FixedBigIntegerRandomNumberGenerator(int bitWidth) |
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.Runtime.Serialization; | |
using System.Text; |
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.Concurrent; | |
using System.Collections.Generic; | |
using System.Drawing; | |
using System.Globalization; | |
using System.IO; | |
using System.Linq; | |
public static class ChiSquared | |
{ | |
/// <summary> |
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.Contracts; | |
using System.IO; | |
using System.Management; | |
using System.Runtime.InteropServices; | |
using System.Security; | |
using Microsoft.Win32.SafeHandles; | |
[SecurityCritical] | |
[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; | |
using System.Collections.Generic; | |
public class BigComplex | |
{ | |
public BigComplex() | |
{ | |
Real = 0; | |
Imaginary = 0; | |
} | |
public BigComplex(BigDecimal real_part) |
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; | |
public class ComplexFFT | |
{ | |
public Complex[] Fft(Complex[] arr) | |
{ | |
var length = arr.Length; | |
var hLength = length >> 1; | |
if (length == 1) | |
return arr; | |
var evenCoefficients = new Complex[hLength]; |
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; | |
/// <summary> | |
/// Murmur3 (128b): 16 MBps. | |
/// MD5 (128b): 7.5 MBps. | |
/// SHA1 (160b): 8.5MBps. | |
/// SHA256: 9.5 MBps. | |
/// *SHA512: 13.5 MBps. | |
/// SHA3 (1024b): 12.5 MBps. | |
/// Tested: I7-8700K @4.2Ghz |
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
#define TESTING | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
using System.Security.Cryptography; | |
using System.Threading; | |
public class CryptoEntropySourceExperimental | |
{ |
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 static class BigIntegerEx | |
{ | |
private static readonly BigInteger Ten = new BigInteger(10); | |
private static readonly BigInteger Three = new BigInteger(3); | |
public static BigInteger ToBigInteger(this char ul) | |
{ | |
return new BigInteger(ul); | |
} | |
public static BigInteger ToBigInteger(this byte ul) | |
{ |
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
[Serializable] | |
public class CryptoRandomNumberGeneratorExperimental : RandomNumberGenerator | |
{ | |
private const double DBi = 1.0 / ulong.MaxValue; | |
private readonly CryptoGetBytesExperimental crng = new CryptoGetBytesExperimental(); | |
public bool NextBool() | |
{ | |
return Sample() < .5; | |
} | |
/// <summary> |