public Streamcipher(BlockcipherKind algorithm, BlockcipherModeKind mode, int max_workers) { if (UnmanagedError.RegisterThread() != ErrorKind.K_ESUCCESS) throw new Exception("unable to register libk error handler"); if ((context = SafeNativeMethods.k_sc_init_with_blockcipher(algorithm, mode, (UIntPtr)max_workers)) == (UIntPtr)0) UnmanagedError.ThrowLastError(); }
public Streamcipher(BlockcipherKind algorithm, BlockcipherModeKind mode) : this(algorithm, mode, 0) { }
internal static extern UIntPtr k_sc_init_with_blockcipher(BlockcipherKind cipher, BlockcipherModeKind mode, UIntPtr max_workers);
internal static extern int k_bcmode_set_mode(UIntPtr context, BlockcipherModeKind mode, Int32 max_workers);
public void SetMode(BlockcipherModeKind mode) { SetMode(mode, 0); }
public void SetMode(BlockcipherModeKind mode, int max_workers) { if (SafeNativeMethods.k_bcmode_set_mode(context, mode, max_workers) != 0) UnmanagedError.ThrowLastError(); }