marqdo

10-hash-secretsok

features/10-hash-secrets.mq.md

Structure

importhash:lib/hash.mq.mdsec:lib/secrets.mq.md
fn · h1Digests and secure tokens
comment

Integrity digests and cryptographic tokens stay in lib/ — do not use math.random for secrets.

fn · h1main
bind `d` = > hash.sha256 text=marqdo
bind `t` = > sec.token_hex n=8
bind `L` = > len `t`
call> print text=`d`
call> print text=`L`
branch
arm`L` == 16
call> print text=mid-m3-ok
armelse
call> print text=mid-m3-fail
Functions
Variables
  • L int
    16
  • d text
    f2f787a9d343fec86007178a1735620f2e8f2c9bb472411a934378791e537143
  • t text
    0f3aa2eed8d16132

Execution

f2f787a9d343fec86007178a1735620f2e8f2c9bb472411a934378791e537143 16 mid-m3-ok

Source

---
title: Mid stdlib — hash and secrets
description: lib/hash + lib/secrets without plugins (Mid M3)
import hash:lib/hash.mq.md
import sec:lib/secrets.mq.md
---

# Digests and secure tokens

Integrity digests and cryptographic tokens stay in `lib/` — do not use `math.random` for secrets.

# main

**`d` = > hash.sha256 text="marqdo"**
**`t` = > sec.token_hex n=8**
**`L` = > len `t`**
> print text=`d`
> print text=`L`
1. `L` == 16
  > print text=mid-m3-ok
2. *
  > print text=mid-m3-fail

Variable