Artifact ddbd429ed80b302967f52be21e4a32781177ba5f:
- File
packages/crypto/lib/sha_openssl.tcl
— part of check-in
[f7efe0061c]
at
2017-09-10 10:47:59
on branch trunk
— ycl {
{accomodate switch from [shelf .subcmd] to [shelf .routine]}
{further development across many modules}
} (user: pooryorick size: 1050)
#! /bin/env tclsh package require {ycl crypto sha generic} [yclprefix] crypto sha generic .spawn [namespace current] proc digest {_ args} { set oldconfig [$_ configure] switch [$_ $ read] { b - binary { } t - text { return -code error [list {text mode not implemented}] } } try { $_ configure {*}$args set res [$_ openssl run preargs [list sha[$_ $ algo] -r [$_ $ path]]] if {![regexp {^([^\s]*)} $res -> sig]} { return -code error [list {error in signature}] } return $sig } finally { $_ configure {*}$oldconfig } } [namespace current] .method digest proc init {_ args} { package require {ycl programs openssl} uplevel 1 [list $_ .switch init {*}$args] [[yclprefix] programs openssl .spawn ${_}::openssl_template] init $_ .routine openssl_template $_ openssl_template find ${_}::openssl $_ .routine openssl #openssl $ stdout {} #{*}$acquire_sha [namespace current] {*}$args return $_ } [namespace current] .method init [namespace current] .routine openssl_template [namespace current] .routine openssl