Skip to content

Feat/rc6#2163

Merged
GCHQDeveloper581 merged 6 commits intogchq:masterfrom
thomasxm:feat/rc6
Mar 7, 2026
Merged

Feat/rc6#2163
GCHQDeveloper581 merged 6 commits intogchq:masterfrom
thomasxm:feat/rc6

Conversation

@thomasxm
Copy link
Contributor

@thomasxm thomasxm commented Jan 25, 2026

Summary (updated)

Adds RC6 block cipher implementation to CyberChef:

  • RC6 - AES finalist by Ron Rivest, Matt Robshaw, Ray Sidney, and Yiqun Lisa Yin

New Operations

RC6 (AES Finalist)

  • RC6 Encrypt - Configurable block encryption (RC6-w/r/b)
  • RC6 Decrypt - Configurable block decryption (RC6-w/r/b)
  • Word sizes: 8, 16, 32, 64, 128, or any multiple of 8 (8-256 bits)
  • Rounds: 1-255 (default 20 for standard RC6-32)
  • Key length: Any (common: 128/192/256-bit)
  • Modes: ECB, CBC, CFB, OFB, CTR

Padding Options

  • PKCS5 (PKCS#7)
  • NO (none - requires block-aligned input)
  • ZERO
  • RANDOM
  • BIT (ISO/IEC 7816-4)

Use Cases

  • General-purpose encryption
  • Legacy system compatibility
  • AES alternative (RC6-32/20 uses same block/key sizes)
  • Educational purposes (studying AES competition finalists)

Files Changed

File Action
src/core/lib/RC6.mjs NEW
src/core/operations/RC6Encrypt.mjs NEW
src/core/operations/RC6Decrypt.mjs NEW
src/core/config/Categories.json Added operations
tests/operations/tests/RC6.mjs NEW
tests/operations/index.mjs Registered tests

Testing

  • All IETF draft test vectors pass (RC6-8, RC6-16, RC6-32, RC6-64, RC6-128, RC6-24, RC6-80)
  • Round-trip tests for all standard word sizes
  • Additional tests for 192/256-bit keys and CTR mode

Implementation Notes

  • Pure JavaScript implementation using BigInt for arbitrary word sizes
  • Supports non-power-of-2 word sizes per IETF specification
  • Consistent API with existing CyberChef cipher operations (SM4, Blowfish, GOST, etc.)

References

Screenshot 2026-01-30 at 21 15 02 Screenshot 2026-01-30 at 21 15 11 Screenshot 2026-01-30 at 21 31 49 Screenshot 2026-01-31 at 12 27 03 Screenshot 2026-01-31 at 12 27 45

@GCHQDeveloper581 GCHQDeveloper581 self-requested a review January 29, 2026 12:09
@GCHQDeveloper581
Copy link
Contributor

Is it worth (?possible?) making the number of rounds a configurable parameter rather than hard-coding it to 20?

(this confused me when I tried some of the other IETF test vectors and the output didn't match until I realised they were for a different number of rounds)

@thomasxm
Copy link
Contributor Author

To make the number of rounds configurable rather than using the default and to match all the test vectors, we’d also need configurable word size. That would take me another few days, but it’s probably worth it to support the full parameterisation.

Add RC6 block cipher encrypt/decrypt operations.

RC6 is a symmetric block cipher designed by Ron Rivest et al.
It was an AES finalist and supports 128/192/256-bit keys.

Features:
- ECB, CBC, CFB, OFB, CTR modes
- Multiple padding options (PKCS7, Zero, None)
- 128-bit block size, 20 rounds

Includes official test vectors from IETF draft.
@thomasxm
Copy link
Contributor Author

thomasxm commented Feb 6, 2026

Done

@thomasxm
Copy link
Contributor Author

Is it worth (?possible?) making the number of rounds a configurable parameter rather than hard-coding it to 20?

(this confused me when I tried some of the other IETF test vectors and the output didn't match until I realised they were for a different number of rounds)

When you have a chance, please review the new implementation :)

Copy link
Contributor

@GCHQDeveloper581 GCHQDeveloper581 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for your excellent contribution.

@GCHQDeveloper581 GCHQDeveloper581 merged commit 81b3e9a into gchq:master Mar 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants