• Re: My experimental HMAC cipher in C99, version 2...

    From jayjwa@jayjwa@atr2.ath.cx.invalid to comp.lang.c,sci.crypt on Wed Feb 18 12:41:15 2026
    From Newsgroup: sci.crypt

    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:

    Why I do not like your code snippets:
    $ gcc hmac.c -o hmac
    hmac.c:29:10: fatal error: hmac_sha2.h: No such file or directory
    29 | #include "hmac_sha2.h"
    | ^~~~~~~~~~~~~
    compilation terminated.

    Well, it uses the following lib:

    https://github.com/ogay/hmac
    It would be better if that project made a library to link against, so
    that you didn't have to put it all on the command line.

    [12:24] jayjwa@ibushi:~/hmac$ gcc -pipe -o ct_hmac_sha2_512
    ct_hmac_sha2_512.c hmac_sha2.c sha2.c
    [12:25] jayjwa@ibushi:~/hmac$ echo "How now brown cow?" > test.txt
    [12:26] jayjwa@ibushi:~/hmac$ ./ct_hmac_sha2_512 test.txt test.enc -e

    === DrMoron Cipher (Fixed TRNG Version) ===

    Mode: ENCRYPT
    WARNING: Using hardcoded demo key - NOT SECURE for production!
    Input file: test.txt
    Output file: test.enc

    Generating 73 bytes of cryptographically secure random data...
    Random prefix generated successfully
    Crypt Round 0:
    ________________________
    P_I = 92 of 92


    Crypt Round 1:
    ________________________
    P_I = 92 of 92


    Encryption complete!
    [12:26] jayjwa@ibushi:~/hmac$ ./ct_hmac_sha2_512 test.enc test.new -d

    === DrMoron Cipher (Fixed TRNG Version) ===

    Mode: DECRYPT
    WARNING: Using hardcoded demo key - NOT SECURE for production!
    Input file: test.enc
    Output file: test.new

    Crypt Round 0:
    ________________________
    P_I = 92 of 92


    Crypt Round 1:
    ________________________
    P_I = 92 of 92


    Decryption complete!
    [12:27] jayjwa@ibushi:~/hmac$ cat test.new
    How now brown cow?
    [12:34] jayjwa@ibushi:~/hmac$ uname -a
    SunOS ibushi 5.11 illumos-f8f3128c12 i86pc i386 i86pc
    --
    PGP Key ID: 781C A3E2 C6ED 70A6 B356 7AF5 B510 542E D460 5CAE
    "The Internet should always be the Wild West!"
    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From scott@scott@slp53.sl.home (Scott Lurndal) to comp.lang.c,sci.crypt on Wed Feb 18 18:06:38 2026
    From Newsgroup: sci.crypt

    jayjwa <jayjwa@atr2.ath.cx.invalid> writes:
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:

    Why I do not like your code snippets:
    $ gcc hmac.c -o hmac
    hmac.c:29:10: fatal error: hmac_sha2.h: No such file or directory
    29 | #include "hmac_sha2.h"
    | ^~~~~~~~~~~~~
    compilation terminated.

    Well, it uses the following lib:

    https://github.com/ogay/hmac
    It would be better if that project made a library to link against, so
    that you didn't have to put it all on the command line.

    [12:24] jayjwa@ibushi:~/hmac$ gcc -pipe -o ct_hmac_sha2_512

    You'd have more command line to work with if you set PS1="$ ".

    I mean, surely you know which host you're logged into and
    which user you logged in with without a constant reminder
    eating up half the command line :-)

    In my case, the current host and working directory is stashed in the
    xterm title bar automatically by a shell function wrapping the cd command.
    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From James Kuyper@jameskuyper@alumni.caltech.edu to comp.lang.c,sci.crypt on Wed Feb 18 13:58:34 2026
    From Newsgroup: sci.crypt

    On 2026-02-18 13:06, Scott Lurndal wrote:
    jayjwa <jayjwa@atr2.ath.cx.invalid> writes:
    ...
    [12:24] jayjwa@ibushi:~/hmac$ gcc -pipe -o ct_hmac_sha2_512

    You'd have more command line to work with if you set PS1="$ ".

    I mean, surely you know which host you're logged into and
    which user you logged in with without a constant reminder
    eating up half the command line :-)

    It depends very much upon your work environment. I've worked in
    environments where I might often be logged into multiple hosts in
    different windows at the same time, and in some cases there were
    multiple different users I might have been logged into a given host.

    In my case, the current host and working directory is stashed in the
    xterm title bar automatically by a shell function wrapping the cd command.


    I agree that the title bar is a more appropriate location for current
    host and current user information. However, I've found it useful to be
    able to tell directly which directory was the current one when I issued
    each command. If the cd (or pushd or popd) command is still on screen,
    it can be figured out, but it is easier when it's part of the prompt. Of course, the value of this depends upon how much work you do at the
    command line. While I was working on NASA projects, most of my work was
    done at the command line.
    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Richard Harnden@richard.nospam@gmail.invalid to comp.lang.c,sci.crypt on Wed Feb 18 19:26:37 2026
    From Newsgroup: sci.crypt

    On 18/02/2026 18:58, James Kuyper wrote:
    On 2026-02-18 13:06, Scott Lurndal wrote:
    jayjwa <jayjwa@atr2.ath.cx.invalid> writes:
    ...
    [12:24] jayjwa@ibushi:~/hmac$ gcc -pipe -o ct_hmac_sha2_512

    You'd have more command line to work with if you set PS1="$ ".

    I mean, surely you know which host you're logged into and
    which user you logged in with without a constant reminder
    eating up half the command line :-)

    It depends very much upon your work environment. I've worked in
    environments where I might often be logged into multiple hosts in
    different windows at the same time, and in some cases there were
    multiple different users I might have been logged into a given host.

    In my case, the current host and working directory is stashed in the
    xterm title bar automatically by a shell function wrapping the cd command.


    I agree that the title bar is a more appropriate location for current
    host and current user information. However, I've found it useful to be
    able to tell directly which directory was the current one when I issued
    each command. If the cd (or pushd or popd) command is still on screen,
    it can be figured out, but it is easier when it's part of the prompt. Of course, the value of this depends upon how much work you do at the
    command line. While I was working on NASA projects, most of my work was
    done at the command line.

    I have a multi-line PS1 for exactly those reasons. Wastes a bit of
    vertical space, but I want the constant reminder about
    this-host-is-production and which directory I'm in.

    Having info in the title very useful when the window is minimised.


    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.c,sci.crypt on Thu Feb 19 12:54:33 2026
    From Newsgroup: sci.crypt

    On 2/18/2026 9:41 AM, jayjwa wrote:
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:

    Why I do not like your code snippets:
    $ gcc hmac.c -o hmac
    hmac.c:29:10: fatal error: hmac_sha2.h: No such file or directory
    29 | #include "hmac_sha2.h"
    | ^~~~~~~~~~~~~
    compilation terminated.

    Well, it uses the following lib:

    https://github.com/ogay/hmac
    It would be better if that project made a library to link against, so
    that you didn't have to put it all on the command line.

    It would be more convenient for sure. Also, I don't want to put ogay's
    hmac files in my repository. A makefile would also help.


    [12:24] jayjwa@ibushi:~/hmac$ gcc -pipe -o ct_hmac_sha2_512 ct_hmac_sha2_512.c hmac_sha2.c sha2.c
    [12:25] jayjwa@ibushi:~/hmac$ echo "How now brown cow?" > test.txt
    [12:26] jayjwa@ibushi:~/hmac$ ./ct_hmac_sha2_512 test.txt test.enc -e

    === DrMoron Cipher (Fixed TRNG Version) ===

    Mode: ENCRYPT
    WARNING: Using hardcoded demo key - NOT SECURE for production!
    Input file: test.txt
    Output file: test.enc

    Generating 73 bytes of cryptographically secure random data...
    Random prefix generated successfully
    Crypt Round 0:
    ________________________
    P_I = 92 of 92


    Crypt Round 1:
    ________________________
    P_I = 92 of 92


    Encryption complete!
    [12:26] jayjwa@ibushi:~/hmac$ ./ct_hmac_sha2_512 test.enc test.new -d

    === DrMoron Cipher (Fixed TRNG Version) ===

    Mode: DECRYPT
    WARNING: Using hardcoded demo key - NOT SECURE for production!
    Input file: test.enc
    Output file: test.new

    Crypt Round 0:
    ________________________
    P_I = 92 of 92


    Crypt Round 1:
    ________________________
    P_I = 92 of 92


    Decryption complete!
    [12:27] jayjwa@ibushi:~/hmac$ cat test.new
    How now brown cow?
    [12:34] jayjwa@ibushi:~/hmac$ uname -a
    SunOS ibushi 5.11 illumos-f8f3128c12 i86pc i386 i86pc


    Excellent! Thanks for giving it a go. My next version will allow one to
    create a secret key file and use it.
    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.c,sci.crypt on Thu Feb 19 12:58:10 2026
    From Newsgroup: sci.crypt

    On 2/19/2026 12:54 PM, Chris M. Thomasson wrote:
    On 2/18/2026 9:41 AM, jayjwa wrote:
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:

    Why I do not like your code snippets:
    $ gcc hmac.c -o hmac
    hmac.c:29:10: fatal error: hmac_sha2.h: No such file or directory
    -a-a-a-a 29 | #include "hmac_sha2.h"
    -a-a-a-a-a-a-a |-a-a-a-a-a-a-a-a-a ^~~~~~~~~~~~~
    compilation terminated.

    Well, it uses the following lib:

    https://github.com/ogay/hmac
    It would be better if that project made a library to link against, so
    that you didn't have to put it all on the command line.

    It would be more convenient for sure. Also, I don't want to put ogay's
    hmac files in my repository. A makefile would also help.
    [...]

    Excellent! Thanks for giving it a go. My next version will allow one to create a secret key file and use it.

    Actually, for the password it can use any existing file. To include
    rand_n and the hash algo, then it would need to be a special file, say:

    secret key:

    <hash_algo>
    <rand_n>
    <payload>

    --- Synchronet 3.21b-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.lang.c,sci.crypt on Sat Feb 21 01:42:59 2026
    From Newsgroup: sci.crypt

    On Sat, 14 Feb 2026 12:50:48 -0800, Chris M. Thomasson wrote:

    Well, it uses the following lib:

    https://github.com/ogay/hmac

    So, go get it. Actually, its pretty nice. That is the only
    dependency. After that, it should work fine. I cannot just copy
    those files from ogay into my repository, right? :^)

    There is a way to bring external dependencies into the source tree automatically <https://git-scm.com/docs/gitsubmodules>.
    --- Synchronet 3.21b-Linux NewsLink 1.2