 |
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
|
|
|
|

June 4th, 2011, 07:10 PM
|
|
Authorized User
|
|
Join Date: Jun 2011
Posts: 38
Thanks: 9
Thanked 0 Times in 0 Posts
|
|
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.
|
|

June 4th, 2011, 11:25 PM
|
|
Wrox Author
|
|
Join Date: Aug 2005
Posts: 206
Thanks: 0
Thanked 20 Times in 20 Posts
|
|
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
|
|

June 5th, 2011, 09:07 AM
|
|
Authorized User
|
|
Join Date: Jun 2011
Posts: 38
Thanks: 9
Thanked 0 Times in 0 Posts
|
|
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 };
|
|

June 5th, 2011, 07:47 PM
|
|
Wrox Author
|
|
Join Date: Aug 2005
Posts: 206
Thanks: 0
Thanked 20 Times in 20 Posts
|
|
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:
|
|
|
 |