コード例 #1
0
        public static ushort DecryptUInt16(
            this ICipher cipher,
            byte[] encrypted)
        {
            if (cipher == null)
            {
                throw new ArgumentNullException(nameof(cipher));
            }
            if (encrypted == null)
            {
                throw new ArgumentNullException(nameof(encrypted));
            }

            var decrypted = cipher.Decrypt(encrypted);

            if (decrypted.Length < 2)
            {
                throw new ArgumentException(Resources.InvalidEncryptedValue);
            }

            return(FromByteArray.ToChar(decrypted));
        }