CryptoSys API Library Manual

cipherStreamHex

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

Syntax

[VBA]
Public Function cipherStreamHex ( _
    szInputHex As String, _
    szKeyHex As String, _
    szIvHex As String, _
    nOptions As Long, _
    Optional nCounter As Long = 0 _
) As String

Parameters

szInputHex
Hex-encoded input data.
szKeyHex
Hex-encoded key.
szIvHex
Hex-encoded Initialization Vector (IV, nonce). Use "" for Arcfour.
nOptions
Algorithm to be used. Select one from:
API_SC_ARCFOUR
API_SC_SALSA20
API_SC_CHACHA20
nCounter
Counter value for ChaCha20 only, otherwise ignored.

Return Value

String: Ciphertext in hex-encoded string or empty string on error.

Remarks

Arcfour: any length key; specify "" 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.
Note different order of parameters from core function.

Example

' Test vector 3
Debug.Print cipherStreamHex("00000000000000000000", "ef012345", "", API_SC_ARCFOUR)
' OK=D6A141A7EC3C38DFBD61
[PREV: cipherStreamFinal...]   [Contents]   [Index]   
   [NEXT: cipherStreamInit...]

Copyright © 2001-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-01-07T07:42:00Z.