libraryextensions/digest/lib/Digest.xtl

Digest.xtl -- the facade of the digest extension: SHA-256 and CRC-32 of text and of files, to check that content is what it should be. Import: "dg:" u_se< "Digest" Files are named by paths under the working directory (or XETAL_DIGEST_ROOT), relative, with no .. Run with xetal-x (xetal-x --ext DIR puts this directory on XETAL_PATH). Each signature line is written out by the binding macro (lib/Ffi.xtlm).

source · imports ffi: lib/Ffi.xtlm

ˡs̲ha256 : Char -> Char

function · line 12

dg:s_ha256 t: the SHA-256 of a text (its UTF-8 bytes), 64 hex digits.

"s_ha256 : text -> text"        ᶠᶠⁱb̲ind< "digest/sha256"
ᶠᶠⁱb̲ind< expands to
ˡs̲ha256 ← { a →
  pa ← a ⎕N̲PUT "ext:digest/sha256?text"
  ⎕N̲GET "ext:digest/sha256"
}

ˡs̲ha256File : Char -> Char

function · line 14

dg:s_ha256File path: the SHA-256 of a file, 64 hex digits.

"s_ha256File : text -> text"    ᶠᶠⁱb̲ind< "digest/sha256_file"
ᶠᶠⁱb̲ind< expands to
ˡs̲ha256File ← { a →
  pa ← a ⎕N̲PUT "ext:digest/sha256_file?text"
  ⎕N̲GET "ext:digest/sha256_file"
}

ˡc̲rc32 : Char -> Int

function · line 16

dg:c_rc32 t: the CRC-32 (IEEE, as zip and PNG use) of a text.

"c_rc32 : text -> int"          ᶠᶠⁱb̲ind< "digest/crc32"
ᶠᶠⁱb̲ind< expands to
ˡc̲rc32 ← { a →
  pa ← a ⎕N̲PUT "ext:digest/crc32?text"
  f̲loor f̲irst n̲umbers ⎕N̲GET "ext:digest/crc32"
}

ˡc̲rc32File : Char -> Int

function · line 18

dg:c_rc32File path: the CRC-32 of a file.

"c_rc32File : text -> int"      ᶠᶠⁱb̲ind< "digest/crc32_file"
ᶠᶠⁱb̲ind< expands to
ˡc̲rc32File ← { a →
  pa ← a ⎕N̲PUT "ext:digest/crc32_file?text"
  f̲loor f̲irst n̲umbers ⎕N̲GET "ext:digest/crc32_file"
}

ˡpackage : Char

value · line 21

The native package behind these functions.

ˡpackage ← "digest"