Menu

Tree [edb356] default tip /
 History

Read Only access


File Date Author Commit
 test.dir 2026-03-19 Brad Lanam Brad Lanam [ea1bf7] more changes for 9.x; clean up build
 .gitignore 2024-11-18 Brad Lanam Brad Lanam [b0a2a4] gitignore
 .hgignore 2026-03-19 Brad Lanam Brad Lanam [ea1bf7] more changes for 9.x; clean up build
 .hgtags 2026-03-19 Brad Lanam Brad Lanam [edb356] Added tag 2.2.0 for changeset ea1bf7b62b70
 CMakeLists.txt 2026-03-19 Brad Lanam Brad Lanam [ea1bf7] more changes for 9.x; clean up build
 LICENSE 2026-03-19 Brad Lanam Brad Lanam [b2ff49] apply patch from gregor ebbing; bump version
 Makefile 2026-03-19 Brad Lanam Brad Lanam [ea1bf7] more changes for 9.x; clean up build
 README.txt 2026-03-19 Brad Lanam Brad Lanam [ea1bf7] more changes for 9.x; clean up build
 mkpkg.sh 2026-03-19 Brad Lanam Brad Lanam [b2ff49] apply patch from gregor ebbing; bump version
 pkgIndex.tcl 2026-03-19 Brad Lanam Brad Lanam [b2ff49] apply patch from gregor ebbing; bump version
 sha.c 2021-06-19 Brad Lanam Brad Lanam [0492b1] copyrights; bump to 2.1.1
 sha.h 2021-06-19 Brad Lanam Brad Lanam [0492b1] copyrights; bump to 2.1.1
 tclsha-tcl9.patch 2026-03-19 Brad Lanam Brad Lanam [b2ff49] apply patch from gregor ebbing; bump version
 tclsha.c 2026-03-19 Brad Lanam Brad Lanam [ea1bf7] more changes for 9.x; clean up build
 tsha.c 2020-08-05 Brad Lanam Brad Lanam [0aae00] command line arg checks

Read Me

2024-11-18
bll: I no longer maintain tcl-sha.  Please contact Eckhard Lehmann.

Version 2.2.0

Changes:
  2.2.0
    - 2026-3-19 applied patch from Gregor Ebbing for tcl 9.x
    - cleaned up makefile
    - added sha256 to CMakeLists.txt
  2.1.1
    - minor cleanup (bll)
  2.1
    - added CMakeLists.txt for cmake build (EL)
    - added -keyhex/-datahex for hex encoded key resp. data (EL)
    - added -keybin/-databin for strictly binary key resp. data (EL)
    - added -output [hex|base64|binary] option. Hex is default as before (EL)
    - removed sha256 package provide from C code (EL)
  2.0.1
    - Fixed pkgIndex.tcl for Windows.
    - Repackaging only.  The sha version number is still 2.0.
  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-2.1.1.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-2.1.1.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:

Using cmake (recommended):

  1. install tcl-devel and cmake for your platform
  2. To build in the "build" directory:

    mkdir build
    cmake -B build
    cmake --build build

    # for unix/linux/darwin
    make

    # for windows, requires the MSVC command prompt
    msbuild tcl-sha.sln /property:Configuration=Release

Using make:

  make CFLAGS="$(pkg-config --cflags tcl)" \
      LIBS="$(pkg-config --libs tcl)"

  To validate against the NIST data:
    (cd test.dir ; tclsh testsha.tcl)
    (cd test.dir ; tclsh testsha.tcl 256)
MongoDB Logo MongoDB