Enciphers data in a hex-encoded string using specified stream cipher.

Namespace:  CryptoSysAPI
Assembly:  diCrSysAPINet (in diCrSysAPINet.dll) Version: 6.22.1.29521

Syntax

C#
public static string Hex(
	string inputHex,
	string keyHex,
	string ivHex,
	int counter,
	CipherStream..::.Algorithm streamAlg
)
Visual Basic (Declaration)
Public Shared Function Hex ( _
	inputHex As String, _
	keyHex As String, _
	ivHex As String, _
	counter As Integer, _
	streamAlg As CipherStream..::.Algorithm _
) As String

Parameters

inputHex
Type: System..::.String
Hex-encoded input data
keyHex
Type: System..::.String
Hex-encoded key
ivHex
Type: System..::.String
Hex-encoded Initialization Vector (IV, nonce) or "" for Arcfour
counter
Type: System..::.Int32
Counter value for ChaCha20 only, otherwise ignored. Use 0 for default.
streamAlg
Type: CryptoSysAPI..::.CipherStream..::.Algorithm
Stream cipher algorithm

Return Value

Ciphertext in hex-encoded string or empty string on error

Remarks

  • Arcfour: any length key; specify null for IV.
  • Salsa20: key must be exactly 16 or 32 bytes and IV exactly 8 bytes long.
  • ChaCha20: key must be exactly 16 or 32 bytes and IV exactly 8, 12, or 16 bytes long. Counter is ignored if IV is 16 bytes.

See Also