• tcllib rot13

    From Gerhard Reithofer@21:1/5 to All on Sat May 21 15:01:04 2022
    Hi *,
    I tried to unrotate a message using tcllib.

    In the manual I found:
    ::tcl::transform::rot chan key
    but no example.

    Can anyone give me a short example how to decrypt a message string like "tffbe://"?

    TIA,
    Gerhard


    --
    Gerhard Reithofer - Techn. EDV Reithofer - http://www.tech-edv.co.at

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Gerhard Reithofer on Sat May 21 14:21:50 2022
    Gerhard Reithofer <[email protected]> wrote:
    Hi *,
    I tried to unrotate a message using tcllib.

    In the manual I found:
    ::tcl::transform::rot chan key
    but no example.

    Can anyone give me a short example how to decrypt a message string like "tffbe://"?

    Verifying what the result should be:

    $ echo abcdefg | rot13
    nopqrst

    "Encrypting" using Tcl:

    $ rlwrap tclsh
    % package require tcl::transform::rot
    1
    % set fd [open rot13.out {WRONLY CREAT TRUNC}]
    file3
    % tcl::transform::rot $fd 13
    file3
    % puts $fd abcdefg
    % close $fd
    % exit

    Checking TCL matches the rot13 CLI command output:

    $ cat rot13.out
    nopqrst

    So for your example string:

    $ rlwrap tclsh
    % package require tcl::transform::rot
    1
    % set fd [open rot14.out {WRONLY CREAT TRUNC}]
    file3
    % tcl::transform::rot $fd 14
    file3
    % puts $fd tffbe://
    % close $fd
    % exit

    $ cat rot14.out
    https://

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Gerhard Reithofer@21:1/5 to Rich on Sun May 22 12:29:52 2022
    Hi Rich,
    expressive and appropriate domain name ;-)

    On Sat, 21 May 2022, Rich wrote:

    Gerhard Reithofer <[email protected]> wrote:
    [ ... ]
    Can anyone give me a short example how to decrypt a message string like "tffbe://"?

    [ ... ]

    So for your example string:

    $ rlwrap tclsh
    % package require tcl::transform::rot
    1
    % set fd [open rot14.out {WRONLY CREAT TRUNC}]
    file3
    % tcl::transform::rot $fd 14
    file3
    % puts $fd tffbe://
    % close $fd
    % exit

    $ cat rot14.out
    https://

    The use of the relected channel is new to me but I can't directly
    convert e. g. a text stored in a variable, am I right?

    Nevertheless an interesting approach for stream processig data.
    The docs seem to be minimal but complete and I did't find a describing overview.

    Thank you very much,
    Gerhard

    --
    Gerhard Reithofer - Techn. EDV Reithofer - http://www.tech-edv.co.at

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Christian Werner@21:1/5 to All on Sun May 22 06:30:31 2022
    Gerhard, try this snippet

    package require tcl::transform::rot
    package require tcl::chan::variable

    set fd [tcl::chan::variable DATA]
    tcl::transform::rot $fd 14
    puts $fd tffbe://
    close $fd

    # DATA should now contain https:// plus newline

    HTH,
    Christian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to Gerhard Reithofer on Sun May 22 15:20:37 2022
    Gerhard Reithofer <[email protected]> wrote:
    Hi Rich,
    expressive and appropriate domain name ;-)

    On Sat, 21 May 2022, Rich wrote:

    Gerhard Reithofer <[email protected]> wrote:
    [ ... ]
    Can anyone give me a short example how to decrypt a message string like
    "tffbe://"?

    [ ... ]

    So for your example string:

    $ rlwrap tclsh
    % package require tcl::transform::rot
    1
    % set fd [open rot14.out {WRONLY CREAT TRUNC}]
    file3
    % tcl::transform::rot $fd 14
    file3
    % puts $fd tffbe://
    % close $fd
    % exit

    $ cat rot14.out
    https://

    The use of the relected channel is new to me but I can't directly
    convert e. g. a text stored in a variable, am I right?

    With this particular proc, it would require some 'juggling'. But the
    actual transform proc is defined in the virtchannel_transform/rot.tcl
    file of tcllib, so you could lift out the transformation proc and
    create a version that does not use reflected channels.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)