Example #1
0
 private static ushort GetMaskedVersion(ushort version, VersionMaskType versionMaskType)
 {
     if (versionMaskType == VersionMaskType.None)
     {
         return version;
     }
     else
     {
         return (ushort)(0xFFFF - version);
     }
 }
 private static ushort GetMaskedVersion(ushort version, VersionMaskType versionMaskType)
 {
     if (versionMaskType == VersionMaskType.None)
     {
         return(version);
     }
     else
     {
         return((ushort)(0xFFFF - version));
     }
 }
Example #3
0
 /// <summary>
 /// Creates a new <see cref="RollingIv"/> instance.
 /// </summary>
 /// <param name="initialIv">The initial IV for the new instance.</param>
 /// <param name="versionMaskType">The <see cref="VersionMaskType"/> for the new instance.</param>
 /// <returns>a new instance of <see cref="RollingIv"/>.</returns>
 public RollingIv CreateEncryptIv(byte[] initialIv, VersionMaskType versionMaskType)
 {
     ushort versionMask = GetMaskedVersion(this.version, versionMaskType);
     return new RollingIv(this.encryptionAlgorithm, initialIv, versionMask);
 }
        /// <summary>
        /// Creates a new <see cref="RollingIv"/> instance.
        /// </summary>
        /// <param name="initialIv">The initial IV for the new instance.</param>
        /// <param name="versionMaskType">The <see cref="VersionMaskType"/> for the new instance.</param>
        /// <returns>a new instance of <see cref="RollingIv"/>.</returns>
        public RollingIv CreateDecryptIv(byte[] initialIv, VersionMaskType versionMaskType)
        {
            ushort versionMask = GetMaskedVersion(_version, versionMaskType);

            return(new RollingIv(_decryptionAlgorithm, initialIv, versionMask));
        }