예제 #1
0
        private CodecDll()
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                _dll = new WindowsDll("encoding.dll");
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                _dll = new LinuxDll("encoding.so");
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                throw new NotSupportedException($"MaxOS is not supported yet");
            }

            _generateKey     = (GenerateKeyDelegate)_dll.GetDelegate <GenerateKeyDelegate>("GenerateKey");
            _encodeFile      = (EncodeFileDelegate)_dll.GetDelegate <EncodeFileDelegate>("EncodeFile");
            _decodeFile      = (DecodeFileDelegate)_dll.GetDelegate <DecodeFileDelegate>("DecodeFile");
            _computeHash     = (ComputeHashDelegate)_dll.GetDelegate <ComputeHashDelegate>("ComputeHash");
            _computeDataHash = (ComputeDataHashDelegate)_dll.GetDelegate <ComputeDataHashDelegate>("ComputeDataHash");
        }
예제 #2
0
 public HashAlgorithmWrapper(IDigest bciDigest)
 {
     HashAlgorithmObject         = bciDigest;
     ComputeHashDelegateInstance = BouncyCastleComputeHashDelegateProvider;
     HashSizeInBits = bciDigest.GetDigestSize() * 8; // GetDigestSize() returns a number of bytes
 }
예제 #3
0
 public HashAlgorithmWrapper(HashAlgorithm hashAlg)
 {
     HashAlgorithmObject         = hashAlg;
     ComputeHashDelegateInstance = hashAlg.ComputeHash;
     HashSizeInBits = hashAlg.HashSize; // HashAlg.HashSize is measured in bits
 }
예제 #4
0
 public HashAlgorithmWrapper( IDigest BCIDigest )
 {
     HashAlgorithmObject = BCIDigest;
     ComputeHashDelegateInstance = BouncyCastleComputeHashDelegateProvider;
     HashSizeInBits = BCIDigest.GetDigestSize() * 8;   // GetDigestSize() returns a number of bytes
 }
예제 #5
0
 public HashAlgorithmWrapper( HashAlgorithm HashAlg )
 {
     HashAlgorithmObject = HashAlg;
     ComputeHashDelegateInstance = HashAlg.ComputeHash;
     HashSizeInBits = HashAlg.HashSize;     // HashAlg.HashSize is measured in bits
 }