Charlie Reinl a écrit : ....... > no what I need is for gambas2, I have to store Passwords in an XML-file, > what means plain-text readable. > So I need a crypting/uncrypting logic . > I put my PW "TOPSECRET" to store > Print crypting("TOPSECRET") > >2sgbtf&& > and get it back by > Print uncrypting("2sgbtf&&") > >TOPSECRET > The uncrypted password is used for a database login. > > or in other words > store pw in plain text encrypted, and > restore encrypted pw to plain text.
This one's not easy: most of possibilities involve a file or a password or both :( May be you could try using 'ssss', it splits a msg (128 chars max) into some encoded strings (ascii) and is able to recover the msg from a certain amount of those strings. The only PB you'll encounter is I don't think there's an "expect" in Gambas, so you'll have to wait 1 sec and feed it char/char, CR inclued. encrypt: ======== $ ssss-split -t2 -n4 <=mean you output 4 strings, but only need 2 of'em WARNING: couldn't get memory lock (ENOMEM, try to adjust RLIMIT_MEMLOCK!). Generating shares using a (2,4) scheme with dynamic security level. Enter the secret, at most 128 ASCII characters: Using a 144 bit security level. <here is the input problem (manual)> 1-3b8c7024bab739bcfeb81a1ff96b0d8ddb43 2-18577a4a8ec859e6b717aaf392717de96b8a 3-06e183909d1d79d08f8d3aa84b78adcafbcf 4-5fe16e96e63699522448cb2b44459d200a06 and decrypt: ============ $ ssss-combine -t2 WARNING: couldn't get memory lock (ENOMEM, try to adjust RLIMIT_MEMLOCK!). Enter 2 shares separated by newlines: <here is the input problem (manual)> Share [1/2]: 1-3b8c7024bab739bcfeb81a1ff96b0d8ddb43 Share [2/2]: 4-5fe16e96e63699522448cb2b44459d200a06 Resulting secret: my loving password Of course, you can use the same trigger (-t) as the number of strings (-n), but in this example, you can afford to loose 2 strings out 4. JY -- Be frank and explicit with your lawyer ... it is his business to confuse the issue afterwards. ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user