From 2a14a7cc451b01957757afbcc0be519bb4065e72 Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Sun, 22 Dec 2024 23:05:33 +0100 Subject: [PATCH] added README --- README.md | 81 ++++ gallery.bash | 4 + gallery/readme_banner.svg | 678 +++++++++++++++++++++++++++++++++ gallery/readme_banner.typ | 50 +++ gallery/readme_banner_dark.svg | 678 +++++++++++++++++++++++++++++++++ src/lib.typ | 2 + typst.toml | 6 +- 7 files changed, 1496 insertions(+), 3 deletions(-) create mode 100644 README.md create mode 100644 gallery.bash create mode 100644 gallery/readme_banner.svg create mode 100644 gallery/readme_banner.typ create mode 100644 gallery/readme_banner_dark.svg diff --git a/README.md b/README.md new file mode 100644 index 0000000..a4afc72 --- /dev/null +++ b/README.md @@ -0,0 +1,81 @@ +

+ + + + Banner + +

+ +**Jumble** is [Typst](https://typst.app) package providing some common hashing functions, as well as other related algorithms. + +## Available methods +- MD4 +- MD5 +- SHA1 +- HMAC +- NTLM +- TOTP +- Base32 encoding / decoding + +## Usage + +For information, please refer to the [manual](manual.pdf) + +To use this package, you can either: +- import the package as a module: + ```typst + #import "jumble/src/lib.typ" as jumble + ... + #jumble.md5(...) + ``` +- import the functions you need from `src/lib.typ`: + ```typst + #import "jumble/src/lib.typ": md5 + ... + #md5(...) + ``` +- import everything: + ```typst + #import "jumble/src/lib.typ": * + ... + #md5(...) + ``` + +### Examples + + + + + + + + + + + + + + +
TypstResult
+ +```typst +#bytes-to-hex(ntlm("Bellevue")) +``` + + +``` +f59d0692bf73b6381e85902a476f097b +``` +
+ +```typst +#bytes-to-hex(md4("Hello World!")) +``` + + +``` +b2a5cc34fc21a764ae2fad94d56fadf6 +``` +
+ +(more documentation and examples are provided in the [manual](manual.pdf)) \ No newline at end of file diff --git a/gallery.bash b/gallery.bash new file mode 100644 index 0000000..cc3cdf6 --- /dev/null +++ b/gallery.bash @@ -0,0 +1,4 @@ +#!/bin/bash + +typst c --root=. --input dark=false gallery/readme_banner.typ gallery/readme_banner.svg +typst c --root=. --input dark=true gallery/readme_banner.typ gallery/readme_banner_dark.svg \ No newline at end of file diff --git a/gallery/readme_banner.svg b/gallery/readme_banner.svg new file mode 100644 index 0000000..609e44a --- /dev/null +++ b/gallery/readme_banner.svg @@ -0,0 +1,678 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gallery/readme_banner.typ b/gallery/readme_banner.typ new file mode 100644 index 0000000..7f283de --- /dev/null +++ b/gallery/readme_banner.typ @@ -0,0 +1,50 @@ +#import "/src/lib.typ": * + +#let dark = sys.inputs.at("dark", default: "false") == "true" + +#set page( + width: auto, + height: auto, + margin: 1cm, + fill: none +) + +#set text( + size: 12pt, + font: "Source Sans 3", + fill: if dark {white} else {black} +) + +#let hex-abc = "0123456789abcdef" +#let g = gradient.linear( + red, + orange, + yellow, + green, + aqua, + blue, + purple +) +#let colorize-hex(txt) = { + let chars = txt.clusters().map(c => { + let v = hex-abc.position(c) + let color = g.sample(v * 100% / 15).lighten(20%).desaturate(40%) + box( + fill: color, + inset: (x: 1pt), + outset: ( + top: 1pt + 0.5pt * v, + bottom: 1pt + 0.5pt * v + ), + raw(c) + ) + }) + + set text(fill: black) + chars.join() +} + +#let txt = "Jumble" +#let cipher = bytes-to-hex(sha1(txt)) + +*sha1("#txt") =* #colorize-hex(cipher) \ No newline at end of file diff --git a/gallery/readme_banner_dark.svg b/gallery/readme_banner_dark.svg new file mode 100644 index 0000000..1131229 --- /dev/null +++ b/gallery/readme_banner_dark.svg @@ -0,0 +1,678 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/lib.typ b/src/lib.typ index 53a1165..bd55f0f 100644 --- a/src/lib.typ +++ b/src/lib.typ @@ -1,3 +1,5 @@ +#let version = version(0, 0, 1) + #import "misc.typ": * #import "sha.typ": * #import "md.typ": * diff --git a/typst.toml b/typst.toml index 131d1e2..e8bf09f 100644 --- a/typst.toml +++ b/typst.toml @@ -9,6 +9,6 @@ authors = [ ] categories = ["scripting", "utility"] license = "Apache-2.0" -description = "A package to hash " -keywords = ["hash", "algorithm", "cryptography", "md5", "sha1"] -exclude = [ "gallery", "gallery.bash", "docs" ] \ No newline at end of file +description = "A package providing some hash functions and related stuff" +keywords = ["hash", "algorithm", "cryptography", "md5", "sha1", "hmac", "totp", "ntlm"] +exclude = [ "gallery", "gallery.bash" ] \ No newline at end of file