()
| 8 | } |
| 9 | |
| 10 | function run() { |
| 11 | console.log(crypto.randomUUID()); |
| 12 | |
| 13 | const array = new Uint32Array(10); |
| 14 | crypto.getRandomValues(array); |
| 15 | |
| 16 | console.log('Your lucky numbers:'); |
| 17 | for (const num of array) { |
| 18 | console.log(num); |
| 19 | } |
| 20 | |
| 21 | const text = 'An obscure body in the S-K System, your majesty. The inhabitants refer to it as the planet Earth.'; |
| 22 | |
| 23 | async function digestMessage(message) { |
| 24 | const encoder = new TextEncoder(); |
| 25 | const data = encoder.encode(message); |
| 26 | const hash = await crypto.subtle.digest('SHA-256', data); |
| 27 | return hash; |
| 28 | } |
| 29 | |
| 30 | digestMessage(text).then((digestBuffer) => { |
| 31 | console.log(digestBuffer.byteLength); |
| 32 | console.log(new Uint8Array(digestBuffer)); |
| 33 | }); |
| 34 | |
| 35 | gen_hmac(); |
| 36 | |
| 37 | gen_rsa_oaep(); |
| 38 | } |
| 39 | |
| 40 | export function encodeDecode() { |
| 41 | const encoded = btoa('Osei'); |
no test coverage detected