Something more clever for ASCII encryption than this?

Everything related to BASIC version 1.x (Oric 1 and Atmos) or HYPERBASIC (Telestrat).
Don't hesitate to give your small program samples, technical insights, or questions...
Brana
Flying Officer
Posts: 169
Joined: Fri Nov 30, 2007 8:30 pm
Contact:

Something more clever for ASCII encryption than this?

Post by Brana »

I am looking for some algorithm to scramble/encrypt my Ascii values (entered text) preferably more... clever way - than offered on this site: http://cryptoclub.org/tools/letter_tonumber.swf

All my entered text is plain Ascii (A = 65, B = 66, C = 67 and so on...)
User entered password is also plain Ascii, so I have two sets of numbers (first one for entered text, and second (shorter one) for entered password), so the goal is to "scramble" the first set of numbers by using the second set of numbers)?

It should support full Ascii (0 - 255) but outputed ("scrambled") values for each "coded" number (at the end) can really be anything; starting from negative to positive (preferably real, meaning - preferably no integer) numbers...)
Godzil
Squad Leader
Posts: 774
Joined: Sat May 21, 2011 7:21 pm
Location: Between UK and France
Contact:

Re: Something more clever for ASCII encryption than this?

Post by Godzil »

I don't see the point of using non integer value for the end result, integer are more easy to process, the Oric is a really slow device.

And there are plenty of encryption algorithm that exist, I wonder what you really want to do, and I think that "strong encryption" on the Oric is basically useless

Could you explain why you use that because it completely change a possible answer.

And if you really want decimal numbers, a simple math equation that can be reversed is more than enough, but need to be sure you'll never get a rounding problem or all of your thing will be failing.
User avatar
Chema
Game master
Posts: 3013
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Something more clever for ASCII encryption than this?

Post by Chema »

If you don't need strong (serious) encryption a simple exclusive or byte by byte between user and pass will do.

Obviously it won't withstand the simplest serious attack...
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Something more clever for ASCII encryption than this?

Post by Dbug »

You could use the ROM (area from C000 to FFFF) to "encrypt" the values:

Code: Select all

FOR index=0 to length
  encrypted[index]=source[index] XOR (PEEK(#C000+index)+index)
NEXT
User avatar
iss
Wing Commander
Posts: 1637
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: Something more clever for ASCII encryption than this?

Post by iss »

As little improvement of Dbug's version you can use the password to generate starting offset in the range $0000..$3FFF and add it to the base $C000, or:

Code: Select all

offset = 0
FOR index=0 to password_length
  offset = (offset * 2) XOR password[index]
NEXT
offset = offset AND #3FFF

FOR index=0 to length
  encrypted[index]=source[index] XOR (PEEK(#C000+offset))
  offset = (offset + 1) AND #3FFF
NEXT
The only drawback of this 'algo': it depends on ROM content - if text is encrypted on Oric-1 it can't be decrypted on Atmos ;).
Post Reply