Crate dia_assert

source ·
Expand description

A small kit for confirming user actions via command line

Project

Features

For important tasks, if you want to confirm the user, you can use low() or high()… to generate a random string, and ask them to type it.

Notes

  • On non-Unix systems, they will generate random strings based on current time.

  • On Unix systems, they will try to read some bytes from /dev/urandom. If any error raises, it reverts back to above method. Also:

    • For security reason, if it detects some abnormal attributes from that file, it will not read any bytes.
    • If reading succeeds, as a nice gesture, it will write some bytes back to that file.
  • Higher levels always generate longer strings.

They might look like these:

LevelSample
low()e9
normal()ac8c
medium()db9c-725a
high()dca9-e93c-f8b2
critical()115a-a983-4c11-4a38

Modules

4.0.0 (November 6th, 2022)

Constants

Crate code name
ID of this crate
Crate name
Crate release date (year/month/day)
Tag, which can be used for logging…
Crate version

Functions

Generates a random hash string on critical level
Generates a random hash string on high level
Generates a random hash string on low level
Generates a random hash string on medium level
Generates a random hash string on normal level