Menu

Tree [33ffd5] default 2.0 /
 History

Read Only access


File Date Author Commit
 test.dir 2020-05-27 Brad Lanam Brad Lanam [1e3336] remove debug
 .hgignore 2020-05-06 Brad Lanam Brad Lanam [6f0a39] update .hgignore
 .hgtags 2020-05-27 Brad Lanam Brad Lanam [fa32db] Added tag 2.0 for changeset 2d1b828eb14b
 Makefile 2020-05-28 Brad Lanam Brad Lanam [33ffd5] makefile fixes for win
 README.txt 2020-05-28 Brad Lanam Brad Lanam [33ffd5] makefile fixes for win
 pkgIndex.tcl 2020-05-27 Brad Lanam Brad Lanam [2d1b82] add hmac; version 2.0
 sha.c 2020-05-27 Brad Lanam Brad Lanam [a8866a] warning fixes
 sha.h 2020-05-27 Brad Lanam Brad Lanam [a8866a] warning fixes
 tclsha.c 2020-05-27 Brad Lanam Brad Lanam [a8866a] warning fixes

Read Me

Version 2.0

Changes:
  2.0
    - Added support for hmac.
    - Code cleanup.
    - Arguments no longer require a specific order.
    - Fixed missing cflags for 32-bit linux (large file support).
    - Cleaned up Makefile.

sha-1.0.zip : binary package
              Includes Linux 32 bit, Linux 64 bit,
              MacOS 64 bit, Windows 64 bit, and Windows 32 bit.
              Does not include the sha-256 binaries.

sha-src-1.0.zip : sources and NIST test suite.

Usage:

  package require sha
  set buffer abc123
  set sha512 [sha -bits 512 -data $buffer]
  set sha512 [sha -bits 512 -file pkgIndex.tcl]
  set sha384 [sha -bits 384 -file pkgIndex.tcl]
  set sha512_224 [sha -bits 512/224 -file pkgIndex.tcl]
  set sha512_256 [sha -bits 512/256 -file pkgIndex.tcl]

  package require sha
  set buffer abc123
  set key def456
  set hmac [sha -bits 512 -key $key -mac hmac -data $buffer]
  set hmac [sha -bits 512 -keyfile pkgIndex.tcl -mac hmac -file pkgIndex.tcl]
  set hmac [sha -bits 384 -keyfile pkgIndex.tcl -mac hmac -file pkgIndex.tcl]

  # Using the -data argument is not recommended for binary data.
  # It should only be used for simple textual data.

  # The sha and sha256 packages cannot both be loaded at the same time
  # due to internal naming conflicts.
  # These are not included in the binaries .zip file.
  package require sha256
  set buffer abc123
  set sha256 [sha -bits 256 -data $buffer]
  set sha224 [sha -bits 224 -file pkgIndex.tcl]

  set buffer abc123
  set key def456
  set hmac [sha -bits 256 -key $key -mac hmac -data $buffer]
  set hmac [sha -bits 224 -keyfile pkgIndex.tcl -mac hmac -file pkgIndex.tcl]
  set hmac [sha -bits 256 -keyfile pkgIndex.tcl -mac hmac -file pkgIndex.tcl]

Building:
  make {linux|darwin|windows}
    make linux should work for freebsd also.

  To validate against the NIST data:
    cd test.dir
    tclsh testsha.tcl
    tclsh testsha.tcl 256