HC256
Hongjun Wu's table-driven software stream cipher with a 256-bit key and IV
Source found and wired, correctness not fully proven. Root API only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.
About HC256
HC256 is a stream cipher from the HC-256 family. It uses a 32-byte (256-bit) key and a 32-byte nonce. NextSSL lists it in the unverified tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).
Overview
HC-256 is a software-oriented stream cipher designed by Hongjun Wu in 2004. Its 128-bit-key sibling HC-128 was selected for the eSTREAM software portfolio, while HC-256 offers a 256-bit key and IV.
HC-256 maintains two secret tables P and Q, each of 1024 32-bit words. At each step one entry of a table is updated with a non-linear function of other entries using rotations, XORs and additions, and an output word is produced by combining the updated entry with a function of the other table. The key and IV initialise the tables through a long setup that runs the cipher 4096 steps without output.
The large state makes HC-256 fast once initialised but costly to set up, so it suits long messages. NextSSL includes HC-256 from source without verification. HC-128, its shorter-key sibling, is in the eSTREAM software portfolio and is the better-studied of the two. Its design avoids S-boxes. It targets long messages on general-purpose processors.
History
2004–2008HC-256 published by Hongjun Wu
ECRYPT launches eSTREAM to find new stream ciphers
eSTREAM project34 designs submitted
eSTREAM projectFinal eSTREAM portfolio published
eSTREAM project
Security notes
No practical attacks on HC-256 are known. Its long initialisation and 8 KiB state make it unsuitable for short messages or constrained devices. NextSSL's implementation is unverified.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| key | 32 | Secret key |
| nonce | 32 | Nonce / IV |
Use it
from nextssl_demo import NextSSL
root = NextSSL(root=True) # tier 'unverified' is reachable from the root API only
ct = root.call("stream_apply", "hc256", None, key, nonce, b"secret")[0] # same call decrypts
nextssl_root_stream_apply("hc256", NULL, key, nonce, data, out);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_streamcipher_in(reg::all(), Policy::Any, "hc256", &Params::new())?;
let ct = alg.apply_keystream(&key, &nonce, b"secret")?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Similar names
Looking for something else?More stream ciphers
All 37Frequently asked questions
What is HC256?
HC256 is a stream cipher in the HC-256 family. HC-256 is a software-oriented stream cipher designed by Hongjun Wu in 2004.
What are the HC256 sizes?
In NextSSL, HC256 uses: key 32 bytes, nonce 32 bytes.
Who designed HC256 and when?
HC256 belongs to the HC-256 family, first published in 2004 by Hongjun Wu.
Is HC256 safe to use?
HC256 is in the unverified tier. Source found and wired, correctness not fully proven. Root API only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).