Skip to content

crypto.rc4: add @[direct_array_access] - #26507

Merged
spytheman merged 1 commit into
vlang:masterfrom
tankf33der:rc4
Feb 2, 2026
Merged

spytheman merged 1 commit into
vlang:masterfrom
tankf33der:rc4

Conversation

@tankf33der

Copy link
Copy Markdown
Contributor

Helps a lot.

import crypto.rc4
import rand
import time

fn main() {
	key := rand.bytes(32)!
	mut c := rc4.new_cipher(key)!
	mut out := []u8{len: 10_000_000}
	mut txt := []u8{len: 10_000_000, init: 255}

	t1 := time.now()
	c.xor_key_stream(mut out, txt)
	println(time.since(t1))
}

master:

$ v run rc4.v && v -prod rc4.v && ./rc4
656.013ms
116.518ms

patch:

$ v run rc4.v && v -prod rc4.v && ./rc4
54.620ms
19.244ms

Note: I want to add that I have my own test vector against another RC4 implementation with very wide coverage.
Everything is ok.

Comment thread vlib/crypto/rc4/rc4.v

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Excellent work.
Thank you @tankf33der πŸ™‡πŸ» .

@spytheman
spytheman merged commit d15f064 into vlang:master Feb 2, 2026
103 of 128 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.

2 participants