Wrox Programmer Forums
|
BOOK: Beginning Cryptography with Java
This is the forum to discuss the Wrox book Beginning Cryptography with Java by David Hook; ISBN: 9780764596339
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Cryptography with Java section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 4th, 2011, 07:10 PM
Authorized User
 
Join Date: Jun 2011
Posts: 38
Thanks: 9
Thanked 0 Times in 0 Posts
Default Going thru Second Chapter?

I'm reading your book. So far good, but at some places I don't understand the technical information, moreover the code is written using bytes and hex code, which makes it difficult to see/understand the encrypted/decrypted message in action. Wasn't it possible to use Strings instead of bytes representing hexadecimal information? Why this has been made complicated for the readers, where String's could have been used.
 
Old June 4th, 2011, 11:25 PM
dgh dgh is offline
Wrox Author
 
Join Date: Aug 2005
Posts: 206
Thanks: 0
Thanked 20 Times in 20 Posts
Default

It's not possible to use Strings to cleanly represent encrypted data without first converting to Hex or some other codec like Base64, so the use of Hex is actually to simplify things. If you read the JavaDoc for java.lang.String concerning byte to String conversion and visa versa you will see why.

Regards,

David
 
Old June 5th, 2011, 09:07 AM
Authorized User
 
Join Date: Jun 2011
Posts: 38
Thanks: 9
Thanked 0 Times in 0 Posts
Default

Thanks for reply.

So you mean encrypted data won't be nicely represented if we use like this

Doing this improves the readability and understanding of code, don't you think so?
Code:
String input = "hello this is second chapter input  example".
byte[] inputByte = input.getBytes();

        byte[]          input = new byte[] { 
                0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 
                0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
                0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
        byte[]		    keyBytes = new byte[] { 
                0x01, 0x23, 0x45, 0x67, (byte)0x89, (byte)0xab, (byte)0xcd, (byte)0xef };
        byte[]		    ivBytes = new byte[] { 
                0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 };
 
Old June 5th, 2011, 07:47 PM
dgh dgh is offline
Wrox Author
 
Join Date: Aug 2005
Posts: 206
Thanks: 0
Thanked 20 Times in 20 Posts
Default

Personally I would not have said so, but I guess that is a matter of opinion. What I can say is that been able to deal with Hex strings is an invaluable skill in both debugging and understanding most standards related to cryptography. From that point of view alone it is worth becoming comfortable with Hex as a format for data description.

Regards,

David
The Following User Says Thank You to dgh For This Useful Post:
boy18nj (June 5th, 2011)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 6 - Code Download Missing for this Chapter dbaechtel BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 0 August 11th, 2009 11:02 AM
Chapter 2 - End of chapter exercises whizzkid1892 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 July 30th, 2008 12:02 PM
Generics chapter 12 difficult chapter i found ...? Larryz C# 2005 1 July 4th, 2007 09:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.