Thread (1 message) 1 message, 1 author, 2015-01-30

Intercepting memory mapped files

From: Valdis.Kletnieks at vt.edu <hidden>
Date: 2015-01-30 13:31:05

On Fri, 30 Jan 2015 06:55:53 -0500, "devendra.aaru" said:
This is not caesar's cipher. If your buffer contains alphabets then only
you can apply caesar cipher.

It should be something like

          encrypted[i] = (data[i] - 3) % 26;
Consider the sequence of 4 hex bytes 0x17314B65.  Your code will output
that as 0x14141414.  What happens when you try to decrypt that?

Issue two:  Your code fails to re-add an  'a' or 'A' as appropriate, so
instead of rotating through ASCII hex codes 41-5A and 61-7A,it smashes
then down to 0-19.

If you're going that route, you need to go the *whole* way down that route:

temp = data[i];
if (temp >= 'A' && temp <= 'Z') encrypted[i] = (temp -3) % 26 + 'A';
else if (temp >= 'a' && temp <= 'z') encrypted[i] = (temp -3) % 26 + 'a';
else encrypted[i] = temp;

Moral of the story: Designing secure usable crypto is a *lot* harder
than it looks.

Also, I'm going to put in a plug for Bruce Schneier's 'Applied Cryptography,
Second Edition' - a must-read if you're planning to do actual crypto work.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150130/9e9cb1a9/attachment.bin 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help