コード例 #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
ファイル: HashAlgorithmWrapper.cs プロジェクト: Muraad/tinhat
 public HashAlgorithmWrapper( IDigest BCIDigest )
 {
     HashAlgorithmObject = BCIDigest;
     ComputeHashDelegateInstance = BouncyCastleComputeHashDelegateProvider;
     HashSizeInBits = BCIDigest.GetDigestSize() * 8;   // GetDigestSize() returns a number of bytes
 }
コード例 #5
0
ファイル: HashAlgorithmWrapper.cs プロジェクト: Muraad/tinhat
 public HashAlgorithmWrapper( HashAlgorithm HashAlg )
 {
     HashAlgorithmObject = HashAlg;
     ComputeHashDelegateInstance = HashAlg.ComputeHash;
     HashSizeInBits = HashAlg.HashSize;     // HashAlg.HashSize is measured in bits
 }