mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: check (mut f Foo) syntax
This commit is contained in:
@@ -79,7 +79,7 @@ pub fn (x &AesCbc) encrypt_blocks(dst mut []byte, src_ []byte) {
|
||||
copy(x.iv, iv)
|
||||
}
|
||||
|
||||
pub fn (x mut AesCbc) decrypt_blocks(dst mut []byte, src []byte) {
|
||||
pub fn (mut x AesCbc) decrypt_blocks(dst mut []byte, src []byte) {
|
||||
if src.len%x.block_size != 0 {
|
||||
panic('crypto.cipher: input not full blocks')
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ mut:
|
||||
len u64
|
||||
}
|
||||
|
||||
fn (d mut Digest) reset() {
|
||||
fn (mut d Digest) reset() {
|
||||
d.s = [u32(0)].repeat(4)
|
||||
d.x = [byte(0)].repeat(block_size)
|
||||
d.s[0] = u32(init0)
|
||||
@@ -55,7 +55,7 @@ pub fn new() &Digest {
|
||||
return d
|
||||
}
|
||||
|
||||
pub fn (d mut Digest) write(p_ []byte) int {
|
||||
pub fn (mut d Digest) write(p_ []byte) int {
|
||||
mut p := p_
|
||||
nn := p.len
|
||||
d.len += u64(nn)
|
||||
@@ -98,7 +98,7 @@ pub fn (d &Digest) sum(b_in []byte) []byte {
|
||||
return b_out
|
||||
}
|
||||
|
||||
pub fn (d mut Digest) checksum() []byte {
|
||||
pub fn (mut d Digest) checksum() []byte {
|
||||
// Append 0x80 to the end of the message and then append zeros
|
||||
// until the length is a multiple of 56 bytes. Finally append
|
||||
// 8 bytes representing the message length in bits.
|
||||
|
||||
@@ -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 mut Cipher) reset() {
|
||||
pub fn (mut c Cipher) reset() {
|
||||
for i in c.s {
|
||||
c.s[i] = 0
|
||||
}
|
||||
@@ -59,7 +59,7 @@ pub fn (c mut 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 mut Cipher) xor_key_stream(dst mut []byte, src []byte) {
|
||||
pub fn (mut c Cipher) xor_key_stream(dst mut []byte, src []byte) {
|
||||
if src.len == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ mut:
|
||||
len u64
|
||||
}
|
||||
|
||||
fn (d mut Digest) reset() {
|
||||
fn (mut d Digest) reset() {
|
||||
d.x = [byte(0)].repeat(chunk)
|
||||
d.h = [u32(0)].repeat(5)
|
||||
d.h[0] = u32(init0)
|
||||
@@ -58,7 +58,7 @@ pub fn new() &Digest {
|
||||
return d
|
||||
}
|
||||
|
||||
pub fn (d mut Digest) write(p_ []byte) int {
|
||||
pub fn (mut d Digest) write(p_ []byte) int {
|
||||
mut p := p_
|
||||
nn := p.len
|
||||
d.len += u64(nn)
|
||||
@@ -102,7 +102,7 @@ pub fn (d &Digest) sum(b_in []byte) []byte {
|
||||
return b_out
|
||||
}
|
||||
|
||||
fn (d mut Digest) checksum() []byte {
|
||||
fn (mut d Digest) checksum() []byte {
|
||||
mut len := d.len
|
||||
// Padding. Add a 1 bit and 0 bits until 56 bytes mod 64.
|
||||
mut tmp := [byte(0)].repeat(64)
|
||||
|
||||
@@ -51,7 +51,7 @@ mut:
|
||||
is224 bool // mark if this digest is SHA-224
|
||||
}
|
||||
|
||||
fn (d mut Digest) reset() {
|
||||
fn (mut d Digest) reset() {
|
||||
d.h = [u32(0)].repeat(8)
|
||||
d.x = [byte(0)].repeat(chunk)
|
||||
if !d.is224 {
|
||||
@@ -92,7 +92,7 @@ pub fn new224() &Digest {
|
||||
return d
|
||||
}
|
||||
|
||||
fn (d mut Digest) write(p_ []byte) int {
|
||||
fn (mut d Digest) write(p_ []byte) int {
|
||||
mut p := p_
|
||||
nn := p.len
|
||||
d.len += u64(nn)
|
||||
@@ -141,7 +141,7 @@ fn (d &Digest) sum(b_in []byte) []byte {
|
||||
return b_out
|
||||
}
|
||||
|
||||
fn (d mut Digest) checksum() []byte {
|
||||
fn (mut d Digest) checksum() []byte {
|
||||
mut len := d.len
|
||||
// Padding. Add a 1 bit and 0 bits until 56 bytes mod 64.
|
||||
mut tmp := [byte(0)].repeat(64)
|
||||
|
||||
@@ -69,7 +69,7 @@ mut:
|
||||
function crypto.Hash
|
||||
}
|
||||
|
||||
fn (d mut Digest) reset() {
|
||||
fn (mut d Digest) reset() {
|
||||
d.h = [u64(0)].repeat(8)
|
||||
d.x = [byte(0)].repeat(chunk)
|
||||
match d.function {
|
||||
@@ -146,7 +146,7 @@ fn new384() &Digest {
|
||||
return new_digest(.sha384)
|
||||
}
|
||||
|
||||
fn (d mut Digest) write(p_ []byte) int {
|
||||
fn (mut d Digest) write(p_ []byte) int {
|
||||
mut p := p_
|
||||
nn := p.len
|
||||
d.len += u64(nn)
|
||||
@@ -209,7 +209,7 @@ fn (d &Digest) sum(b_in []byte) []byte {
|
||||
return b_out
|
||||
}
|
||||
|
||||
fn (d mut Digest) checksum() []byte {
|
||||
fn (mut d Digest) checksum() []byte {
|
||||
// Padding. Add a 1 bit and 0 bits until 112 bytes mod 128.
|
||||
mut len := d.len
|
||||
mut tmp := [byte(0)].repeat(128)
|
||||
|
||||
Reference in New Issue
Block a user