1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

make array.hex() use lowercase

This commit is contained in:
Joe Conigliaro 2019-08-03 15:48:58 +10:00 committed by Alexander Medvednikov
parent 15c5f671f0
commit bfddb9a80f
7 changed files with 7 additions and 7 deletions

View File

@ -259,7 +259,7 @@ pub fn (b []byte) hex() string {
mut hex := malloc(b.len*2+1)
mut ptr := &hex[0]
for i := 0; i < b.len ; i++ {
ptr += C.sprintf(ptr, '%02X', b[i])
ptr += C.sprintf(ptr, '%02x', b[i])
}
return string(hex)
}

View File

@ -23,5 +23,5 @@ fn test_crypto_aes() {
mode := aes.new_cbc(block, iv)
mode.encrypt_blocks(ciphertext, ciphertext)
assert ciphertext.hex() == 'C210459B514668DDC44674885E4979215265A6C44431A248421254EF357A8C2A308A8BDDF5623AF9DF91737562041CF1'
assert ciphertext.hex() == 'c210459b514668ddc44674885e4979215265a6c44431a248421254ef357a8c2a308a8bddf5623af9df91737562041cf1'
}

View File

@ -5,5 +5,5 @@
import crypto.md5
fn test_crypto_md5() {
assert md5.sum('this is a md5 checksum.'.bytes()).hex() == '6FB421FF99036547655984DA12973431'
assert md5.sum('this is a md5 checksum.'.bytes()).hex() == '6fb421ff99036547655984da12973431'
}

View File

@ -19,5 +19,5 @@ fn test_crypto_rc4() {
c.reset()
assert src.hex() == '189A39A91AEA8AFA65'
assert src.hex() == '189a39a91aea8afa65'
}

View File

@ -5,5 +5,5 @@
import crypto.sha1
fn test_crypto_sha1() {
assert sha1.sum('This is a sha1 checksum.'.bytes()).hex() == 'E100D74442FAA5DCD59463B808983C810A8EB5A1'
assert sha1.sum('This is a sha1 checksum.'.bytes()).hex() == 'e100d74442faa5dcd59463b808983c810a8eb5a1'
}

View File

@ -5,5 +5,5 @@
import crypto.sha256
fn test_crypto_sha256() {
assert sha256.sum('This is a sha256 checksum.'.bytes()).hex() == 'DC7163299659529EAE29683EB1FFEC50D6C8FC7275ECB10C145FDE0E125B8727'
assert sha256.sum('This is a sha256 checksum.'.bytes()).hex() == 'dc7163299659529eae29683eb1ffec50d6c8fc7275ecb10c145fde0e125b8727'
}

View File

@ -5,5 +5,5 @@
import crypto.sha512
fn test_crypto_sha512() {
assert sha512.sum512('This is a sha512 checksum.'.bytes()).hex() == '4143E55FCBA7E39B20F62A1368E5EB28F64A8859458886117AC66027832E0F9F5263DAEC688C439D2D0FA07059334668D39E59543039703DBB7E03EC9DA7F8D7'
assert sha512.sum512('This is a sha512 checksum.'.bytes()).hex() == '4143e55fcba7e39b20f62a1368e5eb28f64a8859458886117ac66027832e0f9f5263daec688c439d2d0fa07059334668d39e59543039703dbb7e03ec9da7f8d7'
}