v / vlib / x / crypto / ascon / examples / use_of_hash26.v
16 lines · 14 sloc · 516 bytes · f0731691771ba7e644eeacb67695382fb4660142
Raw
1// Copyright ©2025 blackshirt.
2// Use of this source code is governed by an MIT license
3// that can be found in the LICENSE file.
4//
5import encoding.hex
6import x.crypto.ascon
7
8// The material was generated from https://hashing.tools/ascon/ascon-hash
9fn main() {
10 msg := 'Example of hash256 message'.bytes()
11 // expected output generated from the tool
12 digest := hex.decode('0889515a9cfe28ab3a43882884d5933bb74aa09f3c767f8c699b5d7114811340')!
13
14 out := ascon.sum256(msg)
15 dump(out == digest) // out == digest: true
16}
17