You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error C (from H file to V : warning: implicit declaration of function 'sha3_finalize' /tmp/v_1000/SHA3.01HYG2REZ8HW9F433E3J5B37XR.tmp.c:13117: error: '{' expected (got ";")
#21546
Closed
b-bruno opened this issue
May 22, 2024
· 1 comment
**Prequiste SHA3 C Lib** : https://github.com/brainhub/SHA3IUF/blob/master/sha3.h
V full version: V 0.4.6 0be5377.7a36b44
OS: linux, "Arch Linux"
Processor: 8 cpus, 64bit, little endian, 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
getwd: /home/bruno/Documents/Dev/SHA3
vexe: /home/bruno/Téléchargements/v/v
vexe mtime: 2024-05-22 05:59:15
vroot: OK, value: /home/bruno/Téléchargements/v
VMODULES: OK, value: /home/bruno/.vmodules
VTMP: OK, value: /tmp/v_1000
Git version: git version 2.45.1
Git vroot status: 0.4.6-13-g7a36b44c
.git/config present: true
CC version: cc (GCC) 14.1.1 20240507
thirdparty/tcc status: thirdparty-linux-amd64 40e5cbb5
What did you do? v -g -o vdbg cmd/v && vdbg sha3.v
modulemain#flag -I/home/bruno/Documents/Dev/SHA3/include/#flag -L/home/bruno/Documents/Dev/SHA3/lib/#flag -lsha3//#flag -llibsha3#include "sha3.h"const (
//sha3_keccak_sponge_words = (1600 / 8) / int(sizeof(u64))sha3_keccak_sponge_words=25// = (1600 / 8) / int(sizeof(u64))
)
enumSha3Flagsasu8 {
sha3_flags_none=0sha3_flags_keccak=1
}
enumSha3Return {
sha3_return_ok=0sha3_return_bad_params=1
}
structSha3Context {
saved u64// the portion of the input message that we didn't consume yet
s [sha3_keccak_sponge_words]u64// Keccak's state
sb [sha3_keccak_sponge_words *8]u8// Keccak's state
byte_index u32// 0..7--the next byte after the set one (starts from 0; 0--none are buffered)
word_index u32// 0..24--the next word to integrate input (starts from 0)
capacity_words u32// the double size of the hash output in words (e.g. 16 for Keccak 512)
}
fn C.sha3_init256(context &Sha3Context)
fn C.sha3_init384(context &Sha3Context)
fn C.sha3_init512(context &Sha3Context)
fn C.sha3_set_flags(context &Sha3Context, flag Sha3Flags) Sha3Flags
fn C.sha3_update(context &Sha3Context, buf_in []u8, len u64)
fn C.sha3_finalize(context &Sha3Context) []u8fnmain() {
mutc:= Sha3Context{}
sha3_flags_keccak:= Sha3Flags.sha3_flags_keccak
println('SHA3 test C implementation')
muti:=16777216
C.sha3_init256(&c)
C.sha3_set_flags(&c, sha3_flags_keccak)
for i >0 {
C.sha3_update(&c, "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno".bytes(), 64)
i--
}
hash:= C.sha3_finalize(&c)
println('hash SHA256 $hash.str()')
}
[sha3.zip](https://github.com/vlang/v/files/15402848/sha3.zip)
What did you expect to see?
hash SHA3_256 result
What did you see instead?
Compilation with unknown C compiler
==================
/tmp/v_1000/sha3.01HYG2RMT1WP8CX020BV13RC6N.tmp.c:13117: warning: implicit declaration of function 'sha3_finalize'
/tmp/v_1000/sha3.01HYG2RMT1WP8CX020BV13RC6N.tmp.c:13117: error: '{' expected (got ";")
...
==================
(Use `v -cg` to print the entire error message)
builder error:
==================
C error found. It should never happen, when compiling pure V code.
This is a V compiler bug, please report it using `v bug file.v`,
or goto https://github.com/vlang/v/issues/new/choose .
You can also use #help on Discord: https://discord.gg/vlang .
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered:
V doctor:
What did you do?
v -g -o vdbg cmd/v && vdbg sha3.v
What did you expect to see?
hash SHA3_256 result
What did you see instead?
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: