Tcl Library Source Code

Check-in [885b50ec5e]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:sha1: sha1, sha256 Bugfixes - (original commit, and now) Version bump. sha256 1.0.4 sha1 2.0.4 Fixed testsuite issues introduced by commit [aa67a2cdc0]. The switch from `rename` to `interp alias` to activate an implementation was not compensated for in the code doing the deactivation just a few lines higher.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 885b50ec5e9c389968b132ce20ad01f755f3089107cb5d6d25198f342aa8a06a
User & Date: aku 2019-05-06 22:53:27
Context
2019-05-07
01:21
Integrated the doc overhaul work into the trunk. This makes the various guides official. check-in: 6612c2b8a8 user: aku tags: trunk
2019-05-06
23:53
Merged latest work from trunk Closed-Leaf check-in: c0006570ed user: aku tags: doc-overhaul
22:53
sha1: sha1, sha256 Bugfixes - (original commit, and now) Version bump. sha256 1.0.4 sha1 2.0.4 Fixed testsuite issues introduced by commit [aa67a2cdc0]. The switch from `rename` to `interp alias` to activate an implementation was not compensated for in the code doing the deactivation just a few lines higher. check-in: 885b50ec5e user: aku tags: trunk
01:49
math::quasirandom - Fix testsuite setup - Requirements are 8.5+OO check-in: d898baf8e5 user: aku tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to embedded/md/tcllib/files/modules/sha1/sha1.md.

     1      1   
     2      2   [//000000001]: # (sha1 \- SHA\-x Message\-Digest Algorithm)
     3      3   [//000000002]: # (Generated from file 'sha1\.man' by tcllib/doctools with format 'markdown')
     4      4   [//000000003]: # (Copyright &copy; 2005, Pat Thoyts <[email protected]\.sourceforge\.net>)
     5         -[//000000004]: # (sha1\(n\) 2\.0\.3 tcllib "SHA\-x Message\-Digest Algorithm")
            5  +[//000000004]: # (sha1\(n\) 2\.0\.4 tcllib "SHA\-x Message\-Digest Algorithm")
     6      6   
     7      7   <hr> [ <a href="../../../../toc.md">Main Table Of Contents</a> &#124; <a
     8      8   href="../../../toc.md">Table Of Contents</a> &#124; <a
     9      9   href="../../../../index.md">Keyword Index</a> &#124; <a
    10     10   href="../../../../toc0.md">Categories</a> &#124; <a
    11     11   href="../../../../toc1.md">Modules</a> &#124; <a
    12     12   href="../../../../toc2.md">Applications</a> ] <hr>
................................................................................
    40     40     - [Category](#category)
    41     41   
    42     42     - [Copyright](#copyright)
    43     43   
    44     44   # <a name='synopsis'></a>SYNOPSIS
    45     45   
    46     46   package require Tcl 8\.2  
    47         -package require sha1 ?2\.0\.3?  
           47  +package require sha1 ?2\.0\.4?  
    48     48   
    49     49   [__::sha1::sha1__ ?__\-hex&#124;\-bin__? \[ __\-channel channel__ &#124; __\-file filename__ &#124; ?__\-\-__? *string* \]](#1)  
    50     50   [__::sha1::hmac__ *key* *string*](#2)  
    51     51   [__::sha1::hmac__ ?__\-hex&#124;\-bin__? __\-key key__ \[ __\-channel channel__ &#124; __\-file filename__ &#124; ?__\-\-__? *string* \]](#3)  
    52     52   [__::sha1::SHA1Init__](#4)  
    53     53   [__::sha1::SHA1Update__ *token* *data*](#5)  
    54     54   [__::sha1::SHA1Final__ *token*](#6)  

Changes to embedded/md/tcllib/files/modules/sha1/sha256.md.

     1      1   
     2      2   [//000000001]: # (sha256 \- SHA\-x Message\-Digest Algorithm)
     3      3   [//000000002]: # (Generated from file 'sha256\.man' by tcllib/doctools with format 'markdown')
     4      4   [//000000003]: # (Copyright &copy; 2008, Andreas Kupries <andreas\[email protected]\.sourceforge\.net>)
     5         -[//000000004]: # (sha256\(n\) 1\.0\.3 tcllib "SHA\-x Message\-Digest Algorithm")
            5  +[//000000004]: # (sha256\(n\) 1\.0\.4 tcllib "SHA\-x Message\-Digest Algorithm")
     6      6   
     7      7   <hr> [ <a href="../../../../toc.md">Main Table Of Contents</a> &#124; <a
     8      8   href="../../../toc.md">Table Of Contents</a> &#124; <a
     9      9   href="../../../../index.md">Keyword Index</a> &#124; <a
    10     10   href="../../../../toc0.md">Categories</a> &#124; <a
    11     11   href="../../../../toc1.md">Modules</a> &#124; <a
    12     12   href="../../../../toc2.md">Applications</a> ] <hr>
................................................................................
    40     40     - [Category](#category)
    41     41   
    42     42     - [Copyright](#copyright)
    43     43   
    44     44   # <a name='synopsis'></a>SYNOPSIS
    45     45   
    46     46   package require Tcl 8\.2  
    47         -package require sha256 ?1\.0\.3?  
           47  +package require sha256 ?1\.0\.4?  
    48     48   
    49     49   [__::sha2::sha256__ ?__\-hex&#124;\-bin__? \[ __\-channel channel__ &#124; __\-file filename__ &#124; ?__\-\-__? *string* \]](#1)  
    50     50   [__::sha2::sha224__ ?__\-hex&#124;\-bin__? \[ __\-channel channel__ &#124; __\-file filename__ &#124; ?__\-\-__? *string* \]](#2)  
    51     51   [__::sha2::hmac__ *key* *string*](#3)  
    52     52   [__::sha2::hmac__ ?__\-hex&#124;\-bin__? __\-key key__ \[ __\-channel channel__ &#124; __\-file filename__ &#124; ?__\-\-__? *string* \]](#4)  
    53     53   [__::sha2::SHA256Init__](#5)  
    54     54   [__::sha2::SHA224Init__](#6)  

Changes to idoc/man/files/modules/sha1/sha1.n.

     1      1   '\"
     2      2   '\" Generated from file 'sha1\&.man' by tcllib/doctools with format 'nroff'
     3      3   '\" Copyright (c) 2005, Pat Thoyts <[email protected]\&.sourceforge\&.net>
     4      4   '\"
     5         -.TH "sha1" n 2\&.0\&.3 tcllib "SHA-x Message-Digest Algorithm"
            5  +.TH "sha1" n 2\&.0\&.4 tcllib "SHA-x Message-Digest Algorithm"
     6      6   .\" The -*- nroff -*- definitions below are for supplemental macros used
     7      7   .\" in Tcl/Tk manual entries.
     8      8   .\"
     9      9   .\" .AP type name in/out ?indent?
    10     10   .\"	Start paragraph describing an argument to a library procedure.
    11     11   .\"	type is type of argument (int, etc.), in/out is either "in", "out",
    12     12   .\"	or "in/out" to describe whether procedure reads or modifies arg,
................................................................................
   272    272   ..
   273    273   .BS
   274    274   .SH NAME
   275    275   sha1 \- SHA1 Message-Digest Algorithm
   276    276   .SH SYNOPSIS
   277    277   package require \fBTcl  8\&.2\fR
   278    278   .sp
   279         -package require \fBsha1  ?2\&.0\&.3?\fR
          279  +package require \fBsha1  ?2\&.0\&.4?\fR
   280    280   .sp
   281    281   \fB::sha1::sha1\fR ?\fB-hex|-bin\fR? [ \fB-channel channel\fR | \fB-file filename\fR | ?\fB--\fR? \fIstring\fR ]
   282    282   .sp
   283    283   \fB::sha1::hmac\fR \fIkey\fR \fIstring\fR
   284    284   .sp
   285    285   \fB::sha1::hmac\fR ?\fB-hex|-bin\fR? \fB-key key\fR [ \fB-channel channel\fR | \fB-file filename\fR | ?\fB--\fR? \fIstring\fR ]
   286    286   .sp

Changes to idoc/man/files/modules/sha1/sha256.n.

     1      1   '\"
     2      2   '\" Generated from file 'sha256\&.man' by tcllib/doctools with format 'nroff'
     3      3   '\" Copyright (c) 2008, Andreas Kupries <[email protected]\&.sourceforge\&.net>
     4      4   '\"
     5         -.TH "sha256" n 1\&.0\&.3 tcllib "SHA-x Message-Digest Algorithm"
            5  +.TH "sha256" n 1\&.0\&.4 tcllib "SHA-x Message-Digest Algorithm"
     6      6   .\" The -*- nroff -*- definitions below are for supplemental macros used
     7      7   .\" in Tcl/Tk manual entries.
     8      8   .\"
     9      9   .\" .AP type name in/out ?indent?
    10     10   .\"	Start paragraph describing an argument to a library procedure.
    11     11   .\"	type is type of argument (int, etc.), in/out is either "in", "out",
    12     12   .\"	or "in/out" to describe whether procedure reads or modifies arg,
................................................................................
   272    272   ..
   273    273   .BS
   274    274   .SH NAME
   275    275   sha256 \- SHA256 Message-Digest Algorithm
   276    276   .SH SYNOPSIS
   277    277   package require \fBTcl  8\&.2\fR
   278    278   .sp
   279         -package require \fBsha256  ?1\&.0\&.3?\fR
          279  +package require \fBsha256  ?1\&.0\&.4?\fR
   280    280   .sp
   281    281   \fB::sha2::sha256\fR ?\fB-hex|-bin\fR? [ \fB-channel channel\fR | \fB-file filename\fR | ?\fB--\fR? \fIstring\fR ]
   282    282   .sp
   283    283   \fB::sha2::sha224\fR ?\fB-hex|-bin\fR? [ \fB-channel channel\fR | \fB-file filename\fR | ?\fB--\fR? \fIstring\fR ]
   284    284   .sp
   285    285   \fB::sha2::hmac\fR \fIkey\fR \fIstring\fR
   286    286   .sp

Changes to idoc/www/tcllib/files/modules/sha1/sha1.html.

   103    103   &#124; <a href="../../../toc.html">Table Of Contents</a>
   104    104   &#124; <a href="../../../../index.html">Keyword Index</a>
   105    105   &#124; <a href="../../../../toc0.html">Categories</a>
   106    106   &#124; <a href="../../../../toc1.html">Modules</a>
   107    107   &#124; <a href="../../../../toc2.html">Applications</a>
   108    108    ] <hr>
   109    109   <div class="doctools">
   110         -<h1 class="doctools_title">sha1(n) 2.0.3 tcllib &quot;SHA-x Message-Digest Algorithm&quot;</h1>
          110  +<h1 class="doctools_title">sha1(n) 2.0.4 tcllib &quot;SHA-x Message-Digest Algorithm&quot;</h1>
   111    111   <div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
   112    112   <p>sha1 - SHA1 Message-Digest Algorithm</p>
   113    113   </div>
   114    114   <div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
   115    115   <ul class="doctools_toc">
   116    116   <li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
   117    117   <li class="doctools_section"><a href="#synopsis">Synopsis</a></li>
................................................................................
   127    127   <li class="doctools_section"><a href="#copyright">Copyright</a></li>
   128    128   </ul>
   129    129   </div>
   130    130   <div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2>
   131    131   <div class="doctools_synopsis">
   132    132   <ul class="doctools_requirements">
   133    133   <li>package require <b class="pkgname">Tcl 8.2</b></li>
   134         -<li>package require <b class="pkgname">sha1 <span class="opt">?2.0.3?</span></b></li>
          134  +<li>package require <b class="pkgname">sha1 <span class="opt">?2.0.4?</span></b></li>
   135    135   </ul>
   136    136   <ul class="doctools_syntax">
   137    137   <li><a href="#1"><b class="cmd">::sha1::sha1</b> <span class="opt">?<b class="option">-hex|-bin</b>?</span> [ <b class="option">-channel channel</b> | <b class="option">-file filename</b> | <span class="opt">?<b class="option">--</b>?</span> <i class="arg">string</i> ]</a></li>
   138    138   <li><a href="#2"><b class="cmd">::sha1::hmac</b> <i class="arg">key</i> <i class="arg">string</i></a></li>
   139    139   <li><a href="#3"><b class="cmd">::sha1::hmac</b> <span class="opt">?<b class="option">-hex|-bin</b>?</span> <b class="option">-key key</b> [ <b class="option">-channel channel</b> | <b class="option">-file filename</b> | <span class="opt">?<b class="option">--</b>?</span> <i class="arg">string</i> ]</a></li>
   140    140   <li><a href="#4"><b class="cmd">::sha1::SHA1Init</b></a></li>
   141    141   <li><a href="#5"><b class="cmd">::sha1::SHA1Update</b> <i class="arg">token</i> <i class="arg">data</i></a></li>

Changes to idoc/www/tcllib/files/modules/sha1/sha256.html.

   103    103   &#124; <a href="../../../toc.html">Table Of Contents</a>
   104    104   &#124; <a href="../../../../index.html">Keyword Index</a>
   105    105   &#124; <a href="../../../../toc0.html">Categories</a>
   106    106   &#124; <a href="../../../../toc1.html">Modules</a>
   107    107   &#124; <a href="../../../../toc2.html">Applications</a>
   108    108    ] <hr>
   109    109   <div class="doctools">
   110         -<h1 class="doctools_title">sha256(n) 1.0.3 tcllib &quot;SHA-x Message-Digest Algorithm&quot;</h1>
          110  +<h1 class="doctools_title">sha256(n) 1.0.4 tcllib &quot;SHA-x Message-Digest Algorithm&quot;</h1>
   111    111   <div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
   112    112   <p>sha256 - SHA256 Message-Digest Algorithm</p>
   113    113   </div>
   114    114   <div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
   115    115   <ul class="doctools_toc">
   116    116   <li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
   117    117   <li class="doctools_section"><a href="#synopsis">Synopsis</a></li>
................................................................................
   127    127   <li class="doctools_section"><a href="#copyright">Copyright</a></li>
   128    128   </ul>
   129    129   </div>
   130    130   <div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2>
   131    131   <div class="doctools_synopsis">
   132    132   <ul class="doctools_requirements">
   133    133   <li>package require <b class="pkgname">Tcl 8.2</b></li>
   134         -<li>package require <b class="pkgname">sha256 <span class="opt">?1.0.3?</span></b></li>
          134  +<li>package require <b class="pkgname">sha256 <span class="opt">?1.0.4?</span></b></li>
   135    135   </ul>
   136    136   <ul class="doctools_syntax">
   137    137   <li><a href="#1"><b class="cmd">::sha2::sha256</b> <span class="opt">?<b class="option">-hex|-bin</b>?</span> [ <b class="option">-channel channel</b> | <b class="option">-file filename</b> | <span class="opt">?<b class="option">--</b>?</span> <i class="arg">string</i> ]</a></li>
   138    138   <li><a href="#2"><b class="cmd">::sha2::sha224</b> <span class="opt">?<b class="option">-hex|-bin</b>?</span> [ <b class="option">-channel channel</b> | <b class="option">-file filename</b> | <span class="opt">?<b class="option">--</b>?</span> <i class="arg">string</i> ]</a></li>
   139    139   <li><a href="#3"><b class="cmd">::sha2::hmac</b> <i class="arg">key</i> <i class="arg">string</i></a></li>
   140    140   <li><a href="#4"><b class="cmd">::sha2::hmac</b> <span class="opt">?<b class="option">-hex|-bin</b>?</span> <b class="option">-key key</b> [ <b class="option">-channel channel</b> | <b class="option">-file filename</b> | <span class="opt">?<b class="option">--</b>?</span> <i class="arg">string</i> ]</a></li>
   141    141   <li><a href="#5"><b class="cmd">::sha2::SHA256Init</b></a></li>

Changes to modules/sha1/pkgIndex.tcl.

     5      5   # "package ifneeded" command to set up package-related
     6      6   # information so that packages will be loaded automatically
     7      7   # in response to "package require" commands.  When this
     8      8   # script is sourced, the variable $dir must contain the
     9      9   # full path name of this file's directory.
    10     10   
    11     11   if {![package vsatisfies [package provide Tcl] 8.2]} {return}
    12         -package ifneeded sha256 1.0.3 [list source [file join $dir sha256.tcl]]
    13         -package ifneeded sha1   2.0.3 [list source [file join $dir sha1.tcl]]
           12  +package ifneeded sha256 1.0.4 [list source [file join $dir sha256.tcl]]
           13  +package ifneeded sha1   2.0.4 [list source [file join $dir sha1.tcl]]
    14     14   package ifneeded sha1   1.1.1 [list source [file join $dir sha1v1.tcl]]

Changes to modules/sha1/sha1.man.

     1         -[manpage_begin sha1 n 2.0.3]
            1  +[vset VERSION 2.0.4]
            2  +[manpage_begin sha1 n [vset VERSION]]
     2      3   [see_also md4]
     3      4   [see_also md5]
     4      5   [see_also ripemd128]
     5      6   [see_also ripemd160]
     6      7   [keywords {FIPS 180-1}]
     7      8   [keywords hashing]
     8      9   [keywords message-digest]
................................................................................
    10     11   [keywords security]
    11     12   [keywords sha1]
    12     13   [moddesc   {SHA-x Message-Digest Algorithm}]
    13     14   [copyright {2005, Pat Thoyts <[email protected]>}]
    14     15   [titledesc {SHA1 Message-Digest Algorithm}]
    15     16   [category  {Hashes, checksums, and encryption}]
    16     17   [require Tcl 8.2]
    17         -[require sha1 [opt 2.0.3]]
           18  +[require sha1 [opt [vset VERSION]]]
    18     19   [description]
    19     20   [para]
    20     21   
    21     22   This package provides an implementation in Tcl of the SHA1
    22     23   message-digest algorithm as specified by FIPS PUB 180-1 (1). This
    23     24   algorithm takes a message and generates a 160-bit digest from the
    24     25   input. The SHA1 algorithm is related to the MD4 algorithm (2) but has

Changes to modules/sha1/sha1.tcl.

   646    646       
   647    647       SHA1Update $token [read $channel $chunksize]
   648    648   
   649    649       if {[eof $channel]} {
   650    650           fileevent $channel readable {}
   651    651           set state(reading) 0
   652    652       }
   653         -        
          653  +    return
   654    654   }
   655    655   
   656    656   # -------------------------------------------------------------------------
   657    657   
   658    658   proc ::sha1::sha1 {args} {
   659    659       array set opts {-hex 0 -filename {} -channel {} -chunksize 4096}
   660    660       if {[llength $args] == 1} {
................................................................................
   801    801   	    SwitchTo $e
   802    802   	    break
   803    803   	}
   804    804       }
   805    805       unset e
   806    806   }
   807    807   
   808         -package provide sha1 2.0.3
          808  +package provide sha1 2.0.4
   809    809   
   810    810   # -------------------------------------------------------------------------
   811    811   # Local Variables:
   812    812   #   mode: tcl
   813    813   #   indent-tabs-mode: nil
   814    814   # End:

Changes to modules/sha1/sha256.man.

     1         -[manpage_begin sha256 n 1.0.3]
            1  +[vset VERSION 1.0.4]
            2  +[manpage_begin sha256 n [vset VERSION]]
     2      3   [see_also md4]
     3      4   [see_also md5]
     4      5   [see_also ripemd128]
     5      6   [see_also ripemd160]
     6      7   [see_also sha1]
     7      8   [keywords {FIPS 180-1}]
     8      9   [keywords hashing]
................................................................................
    11     12   [keywords security]
    12     13   [keywords sha256]
    13     14   [moddesc   {SHA-x Message-Digest Algorithm}]
    14     15   [copyright {2008, Andreas Kupries <[email protected]>}]
    15     16   [titledesc {SHA256 Message-Digest Algorithm}]
    16     17   [category  {Hashes, checksums, and encryption}]
    17     18   [require Tcl 8.2]
    18         -[require sha256 [opt 1.0.3]]
           19  +[require sha256 [opt [vset VERSION]]]
    19     20   [description]
    20     21   [para]
    21     22   
    22     23   This package provides an implementation in Tcl of the SHA256 and
    23     24   SHA224 message-digest algorithms as specified by FIPS PUB 180-1
    24     25   (1). These algorithms take a message and generates a 256-bit (224-bit)
    25     26   digest from the input. The SHA2 algorithms are related to the SHA1

Changes to modules/sha1/sha256.tcl.

   172    172   
   173    173       if {![string equal $loaded ""]} {
   174    174           foreach c {
   175    175               SHA256Init   SHA224Init
   176    176               SHA256Final  SHA224Final
   177    177               SHA256Update
   178    178           } {
   179         -            rename ::sha2::$c ::sha2::${c}-${loaded}
          179  +            interp alias {} ::sha2::$c {}
   180    180           }
   181    181       }
   182    182   
   183    183       # Activate the new implementation, if there is any.
   184    184   
   185    185       if {![string equal $key ""]} {
   186    186           foreach c {
................................................................................
   662    662       
   663    663       SHA256Update $token [read $channel $chunksize]
   664    664   
   665    665       if {[eof $channel]} {
   666    666           fileevent $channel readable {}
   667    667           set state(reading) 0
   668    668       }
   669         -	return
          669  +    return
   670    670   }
   671    671   
   672    672   # -------------------------------------------------------------------------
   673    673   
   674    674   proc ::sha2::_sha256 {ver args} {
   675    675       array set opts {-hex 0 -filename {} -channel {} -chunksize 4096}
   676    676       if {[llength $args] == 1} {
................................................................................
   820    820   	    SwitchTo $e
   821    821   	    break
   822    822   	}
   823    823       }
   824    824       unset e
   825    825   }
   826    826   
   827         -package provide sha256 1.0.3
          827  +package provide sha256 1.0.4
   828    828   
   829    829   # -------------------------------------------------------------------------
   830    830   # Local Variables:
   831    831   #   mode: tcl
   832    832   #   indent-tabs-mode: nil
   833    833   # End: