2020-03-19

Tcl: sha256

使用者在命令列輸入一個字串,然後程式計算字串 sha256 的值並且輸出:
#!/usr/bin/env tclsh
if {$argc >= 1} {
    set countString [lindex $argv 0]
} elseif {$argc == 0} {
    puts "Please input a string"
    exit
}

package require sha256
puts "String: $countString"
puts "Result: [string toupper [sha2::sha256 -hex $countString]]"

沒有留言: