Re: how do I hide a variable from viewing

[email protected] (Mark Devine) Tue, 20 May 2025 11:44:55 +0000
Newsgroups perl.perl6.users
Message-ID <DM5PR02MB32105D26E4C03C4D1DC7CA6FA09FA@DM5PR02MB3210.namprd02.prod.outlook.com>
Todd,

I got tired of having clear-text passwords and other sensitive strings in my raku scripts, so I wrote KHPH for myself for use on Linux/UNIX, then published it.  The idea catches criticism because it isn't encryption, but rather just a little obfuscation.  Sometimes a little obfuscation is warranted, imo.

It takes a string, then mangles it into an unrecognizable scrambled form, stashes it in a file, then can be recalled/unscrambled later.

https://github.com/markldevine/raku-KHPH
[https://opengraph.githubassets.com/bb1248fda827f430511302d3f11722d0db89d56a24a36a1cde153f4bde2530fc/markldevine/raku-KHPH]<https://github.com/markldevine/raku-KHPH>
markldevine/raku-KHPH: Keep Honest People Honest - GitHub<https://github.com/markldevine/raku-KHPH>
Keep Honest People Honest - String Obfuscation, Storage, & Retrieval - markldevine/raku-KHPH
github.com
Maybe you'll find it useful, but maybe only on Linux/UNIX.

use KHPH;
KHPH.new(:stash-path('/tmp/.myapp/password.khph')).expose.print;


  *
or -

use KHPH;
my $passowrd = KHPH.new(:stash-path($*HOME ~ '/.rakucache/myapp/password.khph'));
# $password.expose will unscramble the string, so you can substitute it where you need to

Thanks,

Mark Devine
202-878-1500

________________________________
From: ToddAndMargo via perl6-users <[email protected]>
Sent: Tuesday, May 20, 2025 5:29 AM
To: perl6-users <[email protected]>
Subject: how do I hide a variable from viewing

Hi All,

Fedora 41 (Linux)

Since my *.raku can be publicly read, how do I obscure
the contents of a variable so other can not read it?

Currently what I have been doing is setting the file's
ownership to root:root and the attributes to 700 so
only root can see it.

I would be nice to obscure a variable inside the
program though.

Many thanks,
-T