Check-in [04c90026c3]
Overview
Comment:Added info to documentation on how to salt a password for a digest
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | crypto
Files: files | file ages | folders
SHA3-256: 04c90026c3cfc7decc72be86b9d0e3f1df32367d33dd63ba471bb0e2138d7c63
User & Date: bohagan on 2023-10-30 19:18:40
Other Links: branch diff | manifest | tags
Context
2023-11-03
22:03
Moved info commands to tlsInfo.c file. Moved REASON macro definition to tlsInt.h file so all files can use. check-in: 61a7c2c15a user: bohagan tags: crypto
2023-10-30
19:18
Added info to documentation on how to salt a password for a digest check-in: 04c90026c3 user: bohagan tags: crypto
01:37
Added digest HMAC key test cases check-in: 862db54236 user: bohagan tags: crypto
Changes
454
455
456
457
458
459
460

461
462
463
464
465
466
467
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468







+







    <dd>Calculate the message digest for <em>data</em> or file <em>filename</em>
	using <em>type</em> hash algorithm. Returns value as a hex string
	(default) or as a binary value with <em>-bin</em> option. Using
	<em>-chan</em> option, a stacked channel is created and data read
	from the channel is used to calculate a message digest with the result
	returned with the last read operation before EOF. Use <em>-key</em> to
	specify the key and return a Hashed Message Authentication Code (HMAC).
	To salt a password, append or prepend the salt text to the password.
	Type can be any OpenSSL supported hash algorithm including: <b>md4</b>,
	<b>md5</b>, <b>sha1</b>, <b>sha256</b>, <b>sha512</b>, <b>sha3-256</b>,
	etc. See <b>tls::digests</b> command for a full list.</dd>

    <dt><a name="tls::digests"><strong>tls::digests</strong></a></dt>
    <dd>Returns a list of the hash algorithms for <b>tls::digest</b> command.</dd>


1
2
3
4
5
6
7
1
2
3
4
5
6
7
8
+








/*
 * Digest Command and Stacked Transform Channel
 *
 * Copyright (C) 2023 Brian O'Hagan
 *
 */

222
223
224
225
226
227
228
229

230
231
232
233
234
235
236
222
223
224
225
226
227
228

229
230
231
232
233
234
235
236







-
+







	tls::digest md5 -key "Example key" -data "Example string for message digest tests."
    } -result {901DA6E6976A71650C77443C37FF9C7F}

test Digest_HMAC-10.2 {file} -body {
	tls::digest md5 -key "Example key" -file md_data.dat
    } -result {901DA6E6976A71650C77443C37FF9C7F}

test Digest_HMAC-10.3 {channel} -constraint {knownBug} -body {
test Digest_HMAC-10.3 {channel} -constraints {knownBug} -body {
	read_chan md5 md_data.dat -key "Example key"
    } -result {901DA6E6976A71650C77443C37FF9C7F}

test Digest_HMAC-10.4 {data bin} -body {
	string toupper [binary encode hex [tls::digest md5 -bin -key "Example key" -data "Example string for message digest tests."]]
    } -result {901DA6E6976A71650C77443C37FF9C7F}
# Test list protocols