Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Implementation of rot-13

Reply
Thread Tools

Implementation of rot-13

 
 
Lee Francis Wilhelmsen
Guest
Posts: n/a
 
      07-10-2003
Hi

I need to *encrypt* passwords in a XML file so, I have two simple questions.

Is the rot-13 considered *safe* enough for this task (not very important
passwords, but still)?

Where can I find information of how to implement rot-13? I'm really not 100%
sure what it's supposed to do (especially for characters outside of the a-z
and A-Z ranges).

Anyone have any good pointers (links etc) for more information, or even
better, an simple implemention?

Regards
Lee Francis Wilhelmsen

--
In theory, there is no difference between theory and
practice. But, in practice, there is.
-- Jan L.A. van de Snepscheut


 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      07-10-2003
On 10 Jul 2003 16:55:13 +0200, "Lee Francis Wilhelmsen"
<(E-Mail Removed)> wrote or quoted :

>Is the rot-13 considered *safe* enough for this task (not very important
>passwords, but still)?


Heaven's no. It is just sort of way of mincing an oath by putting it
in ROT 13.

see http://mindprod.com/jgloss/password.html for various ways you can
implement passwords.



--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
 
 
 
Dag Sunde
Guest
Posts: n/a
 
      07-11-2003
"Lee Francis Wilhelmsen" <(E-Mail Removed)> wrote in message
news:3f0d7e50$(E-Mail Removed)...
> Hi
>
> I need to *encrypt* passwords in a XML file so, I have two simple

questions.
>
> Is the rot-13 considered *safe* enough for this task (not very important
> passwords, but still)?
>
> Where can I find information of how to implement rot-13? I'm really not

100%
> sure what it's supposed to do (especially for characters outside of the

a-z
> and A-Z ranges).
>
> Anyone have any good pointers (links etc) for more information, or even
> better, an simple implemention?


Mark well the other answers you got in this thread...

But if you're interested in an implementation, here's a variation of rot13,
namely ROT39:

// code start
public class Crypto
{
private final static int UPPER_LIMIT = 125;
private final static int LOWER_LIMIT = 48;
private final static int CHARMAP = 39;

public Crypto()
{
}

/**
* rot39 is a variation of the ROT13 algorithm,
* that also scrambles numbers and, most important in this
* case; xml-tags ("<", ">" & "/")
* @param - data, String to (de)scramble
* @return - The string in "data" in (de)scrambled form.
*/
public String rot39(String data)
{
try
{
byte[] buffer = data.getBytes("ISO-8859-1");

for(int iData = 0; iData < buffer.length; iData++)
{
int iCode = buffer[iData];
if((iCode >= LOWER_LIMIT) && (iCode <= UPPER_LIMIT ))
{
iCode+= CHARMAP;
if(iCode > UPPER_LIMIT)
{
iCode = iCode - UPPER_LIMIT + LOWER_LIMIT - 1;
}
buffer[iData] = (byte)iCode;
}
}
return new String(buffer, "ISO-8859-1");

}
catch( java.io.UnsupportedEncodingException e)
{
System.out.println("Unicode/ISO ****Up!");
System.exit(-1);
return "";
}
}


public static void main(String[] args)
{
Crypto myCrypto = new Crypto();

String buf = myCrypto.rot39( "abcdefghijklmnopqrstuvwxyzĉĝċ_<>='*'" );
System.out.println(buf);

System.out.println( myCrypto.rot39( buf ) );
}

// code end

--
Dag.


 
Reply With Quote
 
Dave Glasser
Guest
Posts: n/a
 
      07-11-2003
dhek bhun kho <(E-Mail Removed)> wrote on Thu, 10 Jul
2003 15:23:42 GMT in comp.lang.java.programmer:


>
>Lol. No, you better not use ROT-13 for encryption, because the password is
>present in the XML file. You can easily figure it out. It's a two way
>'encryption' method like the Caesar key. (I though it died out with FIDO)


V nyjnlf gubhtug gur znva shapgvba bs EBG-13 ba Svqbarg jnf abg sbe
frphevgl, ohg gb cebgrpg crbcyr sebz "nppvqragnyyl" ivrjvat n zrffntr
pbagnvat bofpravgvrf be nqhyg fhowrpg znggre. Gurl jbhyq unir gb
rkcyvpvgyl qrpbqr vg, fb gurl pbhyqa'g pbzcynva gung vg whfg nccrnerq
ba gurve fperra bhg bs gur oyhr. Be fbzrguvat yvxr gung.


----
Check out QueryForm, a free, open source, Java/Swing-based
front end for relational databases.

http://qform.sourceforge.net
 
Reply With Quote
 
dhek bhun kho
Guest
Posts: n/a
 
      07-11-2003
Dave Glasser <(E-Mail Removed)>, Thu, 10 Jul 2003 22:59:49 -0400:

> dhek bhun kho <(E-Mail Removed)> wrote on Thu, 10 Jul
> 2003 15:23:42 GMT in comp.lang.java.programmer:


>>Yby. Ab, lbh orggre abg hfr EBG-13 sbe rapelcgvba, orpnhfr gur cnffjbeq vf
>>cerfrag va gur KZY svyr. Lbh pna rnfvyl svther vg bhg. Vg'f n gjb jnl
>>'rapelcgvba' zrgubq yvxr gur Pnrfne xrl. (V gubhtu vg qvrq bhg jvgu SVQB)


> V nyjnlf gubhtug gur znva shapgvba bs EBG-13 ba Svqbarg jnf abg sbe
> frphevgl, ohg gb cebgrpg crbcyr sebz "nppvqragnyyl" ivrjvat n zrffntr
> pbagnvat bofpravgvrf be nqhyg fhowrpg znggre. Gurl jbhyq unir gb
> rkcyvpvgyl qrpbqr vg, fb gurl pbhyqa'g pbzcynva gung vg whfg nccrnerq
> ba gurve fperra bhg bs gur oyhr. Be fbzrguvat yvxr gung.


Vs lbh arire urneq bs vg, lbh jbhyqa'g unir gur snvagrfg vqrn bs ubj gb
'qrpelcg' vg. Ohg vg fgvyy vf rapelcgvba. Jung'f gung cebtenz pnyyrq
ntnva.. TbyqRq be GvzRq (V yvxrq gung bar). Ohg gur dhrfgvba jnf jurgure
lbh jbhyq nccyl vg gb n cnffjbeq va n KZY svyr. V jbhyqa'g pelcg n
cnffjbeq va EBG-13: jung'f gur frafr bs n cnffjbeq vs lbh qba'g gerng vg
nf fhpu?

Terrgf
Ouha.

 
Reply With Quote
 
Dave Glasser
Guest
Posts: n/a
 
      07-11-2003
dhek bhun kho <(E-Mail Removed)> wrote on Fri, 11 Jul
2003 10:08:24 GMT in comp.lang.java.programmer:

>Dave Glasser <(E-Mail Removed)>, Thu, 10 Jul 2003 22:59:49 -0400:
>
>> dhek bhun kho <(E-Mail Removed)> wrote on Thu, 10 Jul
>> 2003 15:23:42 GMT in comp.lang.java.programmer:

>
>>>Yby. Ab, lbh orggre abg hfr EBG-13 sbe rapelcgvba, orpnhfr gur cnffjbeq vf
>>>cerfrag va gur KZY svyr. Lbh pna rnfvyl svther vg bhg. Vg'f n gjb jnl
>>>'rapelcgvba' zrgubq yvxr gur Pnrfne xrl. (V gubhtu vg qvrq bhg jvgu SVQB)

>
>> V nyjnlf gubhtug gur znva shapgvba bs EBG-13 ba Svqbarg jnf abg sbe
>> frphevgl, ohg gb cebgrpg crbcyr sebz "nppvqragnyyl" ivrjvat n zrffntr
>> pbagnvat bofpravgvrf be nqhyg fhowrpg znggre. Gurl jbhyq unir gb
>> rkcyvpvgyl qrpbqr vg, fb gurl pbhyqa'g pbzcynva gung vg whfg nccrnerq
>> ba gurve fperra bhg bs gur oyhr. Be fbzrguvat yvxr gung.

>
>Vs lbh arire urneq bs vg, lbh jbhyqa'g unir gur snvagrfg vqrn bs ubj gb
>'qrpelcg' vg. Ohg vg fgvyy vf rapelcgvba. Jung'f gung cebtenz pnyyrq
>ntnva.. TbyqRq be GvzRq (V yvxrq gung bar). Ohg gur dhrfgvba jnf jurgure
>lbh jbhyq nccyl vg gb n cnffjbeq va n KZY svyr. V jbhyqa'g pelcg n
>cnffjbeq va EBG-13: jung'f gur frafr bs n cnffjbeq vs lbh qba'g gerng vg
>nf fhpu?



V erzrzore TbyqRq. V hfrq gb hfr na bssyvar ernqre pnyyrq Fvyire
Kcerff ol Urpgbe Fnagbf. Naq sbe vgf cyhttnoyr rqvgbe V hfrq DRqvg,
juvpu yngre, V guvax, orpnzr gur Frzjner rqvgbe. Obgu cebqhpgf, V
oryvrir, ner ybat tbar abj. Nu, zrzbevrf...


----
Check out QueryForm, a free, open source, Java/Swing-based
front end for relational databases.

http://qform.sourceforge.net
 
Reply With Quote
 
Bent C Dalager
Guest
Posts: n/a
 
      07-12-2003
In article <(E-Mail Removed). back.org>,
dhek bhun kho <(E-Mail Removed)> wrote:
>Dave Glasser <(E-Mail Removed)>, Thu, 10 Jul 2003 22:59:49 -0400:
>
>> dhek bhun kho <(E-Mail Removed)> wrote on Thu, 10 Jul
>> 2003 15:23:42 GMT in comp.lang.java.programmer:

>
>>>Yby. Ab, lbh orggre abg hfr EBG-13 sbe rapelcgvba, orpnhfr gur cnffjbeq vf
>>>cerfrag va gur KZY svyr. Lbh pna rnfvyl svther vg bhg. Vg'f n gjb jnl
>>>'rapelcgvba' zrgubq yvxr gur Pnrfne xrl. (V gubhtu vg qvrq bhg jvgu SVQB)

>
>> V nyjnlf gubhtug gur znva shapgvba bs EBG-13 ba Svqbarg jnf abg sbe
>> frphevgl, ohg gb cebgrpg crbcyr sebz "nppvqragnyyl" ivrjvat n zrffntr
>> pbagnvat bofpravgvrf be nqhyg fhowrpg znggre. Gurl jbhyq unir gb
>> rkcyvpvgyl qrpbqr vg, fb gurl pbhyqa'g pbzcynva gung vg whfg nccrnerq
>> ba gurve fperra bhg bs gur oyhr. Be fbzrguvat yvxr gung.

>
>Vs lbh arire urneq bs vg, lbh jbhyqa'g unir gur snvagrfg vqrn bs ubj gb
>'qrpelcg' vg. Ohg vg fgvyy vf rapelcgvba. Jung'f gung cebtenz pnyyrq
>ntnva.. TbyqRq be GvzRq (V yvxrq gung bar). Ohg gur dhrfgvba jnf jurgure
>lbh jbhyq nccyl vg gb n cnffjbeq va n KZY svyr. V jbhyqa'g pelcg n
>cnffjbeq va EBG-13: jung'f gur frafr bs n cnffjbeq vs lbh qba'g gerng vg
>nf fhpu?
>
>Terrgf
>Ouha.
>



--
Bent Dalager - http://www.velocityreviews.com/forums/(E-Mail Removed) - http://www.pvv.org/~bcd
powered by emacs
 
Reply With Quote
 
Bent C Dalager
Guest
Posts: n/a
 
      07-12-2003
In article <(E-Mail Removed). back.org>,
dhek bhun kho <(E-Mail Removed)> wrote:
>
>Vs lbh arire urneq bs vg, lbh jbhyqa'g unir gur snvagrfg vqrn bs ubj gb
>'qrpelcg' vg. Ohg vg fgvyy vf rapelcgvba.


Gur grez "rapelcgvba" graqf gb or erfreirq sbe grpuavdhrf gung unir
fbzr ebohfgarff ntnvafg nggnpx. Guvf jbhyq graq gb rkpyhqr ebg-13,
juvpu vf zhpu gbb anvir gurfr qnlf naq gurersber zber cebcreyl
ersreerq gb nf na rapbqvat grpuavdhr.

Cheers
Bent D
--
Bent Dalager - (E-Mail Removed) - http://www.pvv.org/~bcd
powered by emacs
 
Reply With Quote
 
Thomas Weidenfeller
Guest
Posts: n/a
 
      07-18-2003
dhek bhun kho <(E-Mail Removed)> writes:
> LOL. But if you are using Google and never heard of it, then it still
> is effective.


No, it is not. A simple statistical analysis of the encrypted text will
reveal that the symbols have the same distribution as characters in a
normal, unencrypted text. With that knowledge it is trivial to
calculate the offset of characters, or one could even try all offsets.

/Thomas
 
Reply With Quote
 
Dale King
Guest
Posts: n/a
 
      07-23-2003
In article <(E-Mail Removed). back.org>,
(E-Mail Removed) says...
> (E-Mail Removed) (Orag P Qnyntre), Fng, 12 Why 2003 07:22:38 +0000:
>
> YBY. Ohg vs lbh ner hfvat Tbbtyr naq arire urneq bs vg, gura vg
> fgvyy vf rssrpgvir. Gur HF qvq fbzrguvat yvxr gung jvgu fbzr 'pbqr'

onfrq
> ba n qrnq ynathntr, be jnf gung whfg n zbivr? V guvax boshfpngvba vf n
> orggre jbeq vafgrnq bs pnyyvat vg rapelcgvba. Ohg url vg whfg

abzrapyngher
> naq n avpr rkphfr gb cbfg.


Decoding part of that:

> LOL. But if you are using Google and never heard of it, then it
> still is effective. The US did something like that with some 'code' based
> on a dead language, or was that just a movie?


It wasn't a truly dead language, but it did happen AND was a movie. In
WWII they used Navajo as the language. It was not always a straight
translation so even if you knew Navajo, you did not necessarily know what
they were talking about. Since Navajo did not have words for a tank, for
example, they might use the Navajo word for turtle. The Navajo code was
supposedly the only one never broken by the Japanese.

It was a movie last year with Nicolas Cage:
http://www.mgm.com/windtalkers/
--
Dale King
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insertion Sort : C++ implementation 100 times slower than C implementation sanket C++ 7 11-03-2011 05:00 AM
Knowing the implementation, are all undefined behaviours become implementation-defined behaviours? Michael Tsang C Programming 54 03-30-2010 07:46 AM
Knowing the implementation, are all undefined behaviours become implementation-defined behaviours? Michael Tsang C++ 32 03-01-2010 09:15 PM
can anyone guide me in flight-mode implementation for Windows mobile 5.0? vivekanand holla Wireless Networking 1 11-10-2005 11:15 AM
transport protocol implementation in NDIS zenhwa Wireless Networking 0 09-14-2004 11:38 PM



Advertisments