mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
vlib: fix mutable args
This commit is contained in:
parent
34e0b164eb
commit
0bcc53c366
13 changed files with 54 additions and 54 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue