* fix the usage of unresolved static[T] parameters in proc signatures * fix tsametype and tmacrogenerics * Allow creating composite type classes with concepts and using them in type signatures * Allow integers to be used in ident concatenations * Support using imported C++ generic types in proc signatures * fixes #7230 * closes #7379 * re-enable some metatype tests
32 lines
982 B
Nim
32 lines
982 B
Nim
type
|
|
Hash*[bits: static[int]] = object
|
|
data*: array[bits div 8, uint8]
|
|
|
|
{.emit: """
|
|
|
|
void sha_256(void* input, int input_len, void* output, int output_len) {}
|
|
void sha_512(void* input, int input_len, void* output, int output_len) {}
|
|
|
|
void keccak_256(void* input, int input_len, void* output, int output_len) {}
|
|
void keccak_512(void* input, int input_len, void* output, int output_len) {}
|
|
|
|
""".}
|
|
|
|
template defineKeccak(bits: untyped) =
|
|
proc `extKeccak bits`(output: pointer, outSize: csize, input: pointer, inputSize: csize) {.nodecl, importc: "keccak_" & astToStr(bits).}
|
|
|
|
template defineSha(bits: static[int]) =
|
|
proc `extSha bits`(output: pointer, outSize: csize, input: pointer, inputSize: csize) {.nodecl, importc: "sha_" & astToStr(bits).}
|
|
|
|
template defineHashProcs(bits) =
|
|
defineSha(bits)
|
|
defineKeccak(bits)
|
|
|
|
defineHashProcs(256)
|
|
defineHashProcs(512)
|
|
|
|
extSha256(nil, 0, nil, 0)
|
|
extSha512(nil, 0, nil, 0)
|
|
extKeccak256(nil, 0, nil, 0)
|
|
extKeccak512(nil, 0, nil, 0)
|
|
|