Post subject: Encryption in Asm Posted: Fri Oct 14, 2011 1:59 am
Amateur Beta Collector
Joined Fri Dec 24, 2010 11:12 pm
Posts 179
Location /dev/chair
Favourite OS DreckigOS v0.007 Alpha
I am working on an kernel for my Real mode OS in Asm. x86, of course. I want to write a subroutine for encryption of text input. It doesn't need to be complicated, I was thinking just shift the ASCII value by an arbitrary number. I tried, but am not having any luck. Help!!!
Post subject: Re: Encryption in Asm Posted: Sat Mar 03, 2012 4:59 pm
Newbie Beta Collector
Joined Sun Feb 26, 2012 10:34 pm
Posts 13
Favourite OS Chicago
I would suggest you to get a hold of the Phalkon Skism tutorials in virii making. There is quite a lot about encryption/decryption routines in Assembly. Normally you would go for a XOR cycle, if you want to keep it simple, but you can also make it more interesting, using an encryption that supports private and public keys.
Post subject: Re: Encryption in Asm Posted: Thu Apr 19, 2012 6:08 pm
Amateur Beta Collector
Joined Thu Dec 22, 2011 2:51 pm
Posts 72
Favourite OS NeXTStep/OpenStep
Hi,
the problematic thing with shifts is that they are 'lossy'. When you shift the value 65 (Character 'A', 01000001 Binary) by, lets say, 4 places to the right, you get 00000100. The right shift operation places binary zeros to the at left-most positions. But when you now do the oposite operation, a left shift, which places binary zeros at the right-most places, you get 01000000, which is a decimal 64 and not 65 which would be the value you expect !!!
So said that the shift-operations are lossy, you need a lossless operation, such as rotation and/or XORing. You could, for example, combine rotation with XORing. In the first phase rotate a byte and in the second phase you could XOR the rotated value by a constant (Encryption). In the Decryption phase do the operations you did in the Encyption phase in the oposite order: Here first XORing than rotation
Users browsing this forum: No registered users and 1 guest
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum
All views expressed in these forums are those of the author and do not necessarily represent the views of the BetaArchive site owner.