Re: Intercepting memory mapped files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Attachment: pgpROiqozlB8x.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux