public RollingIv ( ICryptoAlgorithm algorithm, byte initialIv, ushort versionMask ) : System | ||
algorithm | ICryptoAlgorithm | The |
initialIv | byte | The initial IV for this instance. |
versionMask | ushort | The version mask used for header creation. |
return | System |
public RollingIv(ICryptoAlgorithm algorithm, byte[] initialIv, ushort versionMask)
{
Guard.NotNull(() => algorithm, algorithm);
Guard.NotNull(() => initialIv, initialIv);
if (initialIv.Length != 4)
{
throw new ArgumentException(CommonStrings.IvMustBe4Bytes, "initialIv");
}
this.algorithm = algorithm;
this.iv = initialIv.FastClone();
// Flip the version mask.
this.versionMask = (ushort)((versionMask >> 8) | ((versionMask & 0xFF) << 8));
}