bliss

KISS in Lua
git clone git://bvnf.space/bliss.git
Log | Files | Refs | README | LICENSE

doc.txt (1418B)


      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
BLISS
=====

bliss/ contains the library, main.lua provides an interface to the library.
The library is split into multiple files, but bliss/init.lua collects them all
together so that the whole library is loaded if you run:

    local bliss = require "bliss"

Most of the library functions are put directly into the bliss table (eg bliss.setup)
but some are put into a subtable:
    bliss.b3sum.init
    bliss.b3sum.update
    bliss.b3sum.finalize

OVERVIEW
--------

Setup the environment (colors, read KISS_* variables):

    local env = bliss.setup()

env must be kept in scope until the end of the program because env.atexit implements
an EXIT handler by means of a finalizer (__gc). Beware that os.exit has been
monkey-patched so that the Lua state is properly closed by default.

BLAKE3 wrapper
--------------

Initialise the hasher context:

    local ctx = bliss.b3sum.init()

Add string input to the hasher:

    bliss.b3sum.update(ctx, data)

Finalize the hasher and return the output encoded as a hex string. The default value of n is 32.

    bliss.b3sum.finalize(ctx [, n])

MISC
----

If writing a library using bliss, you may prefer to require each submodule individually, like this:

    local pkg = require "bliss.pkg"
    local utils = require "bliss.utils"

    utils.setup()
    ...

rather than use the init.lua helper which bundles everything together. The submodules use this style themselves.