Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #7462
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Using encryption with special Unicode characters |
| Date | 2011-08-29 04:29 -0700 |
| Organization | Canadian Mind Products |
| Message-ID | <bhtm571dgtauenant0mtgo3f1qu4lmg2s5@4ax.com> (permalink) |
| References | <OvWdnUIcqeRBsMbTnZ2dnUVZ_gCdnZ2d@westnet.com.au> |
On Mon, 29 Aug 2011 16:11:13 +1000, "Qu0ll" <Qu0llSixFour@gmail.com> wrote, quoted or indirectly quoted someone who said : >raw.getBytes() I suspect someday this method will be deprecated. raw.getBytes( encoding ) is what you want since the receiver and sender might not have the same default encoding. Encryption algorinthms concern themselves with bytes. So you want to deal with strings or chars you have to convert them to bytes, encrypt, decrypt than turn them back to strings/chars. The art of converting String to bytes is called encoding, which has nothing to do with encryption. See http://mindprod.com/jgloss/encoding.html You have to know something about the distribution of your characters to choose an optimal encoding. The brute force method is to convert your string into a UTF-16 array of byte pairs. However that more than doubles the size of the encrypted bytes over optimal. You can also compress the string first to get a compact byte string. This takes more computing time, but reduces the size of the encrypted bytes. see http://mindprod.com/jgloss/compression.html -- Roedy Green Canadian Mind Products http://mindprod.com The modern conservative is engaged in one of man's oldest exercises in moral philosophy; that is, the search for a superior moral justification for selfishness. ~ John Kenneth Galbraith (born: 1908-10-15 died: 2006-04-29 at age: 97)
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread
Using encryption with special Unicode characters "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-08-29 16:11 +1000
Re: Using encryption with special Unicode characters Mayeul <mayeul.marguet@free.fr> - 2011-08-29 08:56 +0200
Re: Using encryption with special Unicode characters "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-08-29 17:18 +1000
Re: Using encryption with special Unicode characters Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-08-29 00:29 -0700
Re: Using encryption with special Unicode characters Roedy Green <see_website@mindprod.com.invalid> - 2011-08-29 04:29 -0700
csiph-web