mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vlib: fix mutable args
This commit is contained in:

committed by
Alexander Medvednikov

parent
34e0b164eb
commit
0bcc53c366
@ -49,7 +49,7 @@ pub fn new_cipher(key []byte) ?Cipher {
|
||||
//
|
||||
// Deprecated: Reset can't guarantee that the key will be entirely removed from
|
||||
// the process's memory.
|
||||
pub fn (c &Cipher) reset() {
|
||||
pub fn (c mut Cipher) reset() {
|
||||
for i in c.s {
|
||||
c.s[i] = u32(0)
|
||||
}
|
||||
@ -59,7 +59,7 @@ pub fn (c &Cipher) reset() {
|
||||
|
||||
// xor_key_stream sets dst to the result of XORing src with the key stream.
|
||||
// Dst and src must overlap entirely or not at all.
|
||||
pub fn (c &Cipher) xor_key_stream(dst, src []byte) {
|
||||
pub fn (c mut Cipher) xor_key_stream(dst mut []byte, src []byte) {
|
||||
if src.len == 0 {
|
||||
return
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ fn test_crypto_rc4() {
|
||||
mut src := 'toencrypt'.bytes()
|
||||
|
||||
// src & dst same, encrypt in place
|
||||
c.xor_key_stream(src, src) // encrypt data
|
||||
c.xor_key_stream(mut src, src) // encrypt data
|
||||
|
||||
c.reset()
|
||||
|
||||
|
Reference in New Issue
Block a user