Skip to content

Commit 3aed78e

Browse files
authored
crypto: add missing doc comments for public methods (#23864)
1 parent e467747 commit 3aed78e

File tree

5 files changed

+8
-0
lines changed

5 files changed

+8
-0
lines changed

vlib/crypto/cipher/cfb.v

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ fn new_cfb(b Block, iv []u8, decrypt bool) Cfb {
6363
return x
6464
}
6565

66+
// xor_key_stream xors each byte in the given slice with a byte from the key stream.
6667
pub fn (mut x Cfb) xor_key_stream(mut dst []u8, src []u8) {
6768
unsafe {
6869
mut local_dst := *dst

vlib/crypto/cipher/ctr.v

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ pub fn new_ctr(b Block, iv []u8) Ctr {
4949
}
5050
}
5151

52+
// xor_key_stream xors each byte in the given slice with a byte from the key stream.
5253
pub fn (mut x Ctr) xor_key_stream(mut dst []u8, src []u8) {
5354
unsafe {
5455
mut local_dst := *dst

vlib/crypto/cipher/ofb.v

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub fn new_ofb(b Block, iv []u8) Ofb {
3535
return x
3636
}
3737

38+
// xor_key_stream xors each byte in the given slice with a byte from the key stream.
3839
pub fn (mut x Ofb) xor_key_stream(mut dst []u8, src []u8) {
3940
unsafe {
4041
mut local_dst := *dst

vlib/crypto/des/des.v

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ fn (mut c DesCipher) generate_subkeys(key_bytes []u8) {
5656
}
5757
}
5858

59+
// encrypt a block of data using the DES algorithm
5960
pub fn (c &DesCipher) encrypt(mut dst []u8, src []u8) {
6061
if src.len < block_size {
6162
panic('crypto/des: input not full block')
@@ -69,6 +70,7 @@ pub fn (c &DesCipher) encrypt(mut dst []u8, src []u8) {
6970
encrypt_block(c.subkeys[..], mut dst, src)
7071
}
7172

73+
// decrypt a block of data using the DES algorithm
7274
pub fn (c &DesCipher) decrypt(mut dst []u8, src []u8) {
7375
if src.len < block_size {
7476
panic('crypto/des: input not full block')
@@ -94,6 +96,7 @@ pub fn new_triple_des_cipher(key []u8) cipher.Block {
9496
return c
9597
}
9698

99+
// encrypt a block of data using the TripleDES algorithm
97100
pub fn (c &TripleDesCipher) encrypt(mut dst []u8, src []u8) {
98101
if src.len < block_size {
99102
panic('crypto/des: input not full block')
@@ -130,6 +133,7 @@ pub fn (c &TripleDesCipher) encrypt(mut dst []u8, src []u8) {
130133
binary.big_endian_put_u64(mut dst, permute_final_block(pre_output))
131134
}
132135

136+
// decrypt a block of data using the TripleDES algorithm
133137
pub fn (c &TripleDesCipher) decrypt(mut dst []u8, src []u8) {
134138
if src.len < block_size {
135139
panic('crypto/des: input not full block')

vlib/crypto/rand/rand.v

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ struct ReadError {
88
Error
99
}
1010

11+
// msg returns the error message.
1112
pub fn (err ReadError) msg() string {
1213
return 'crypto.rand.read() error reading random bytes'
1314
}

0 commit comments

Comments
 (0)