Click here to Skip to main content
16,014,392 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: help needed...!!! Pin
Colin Leitner28-Jul-02 8:11
Colin Leitner28-Jul-02 8:11 
GeneralRe: help needed...!!! Pin
Paul Watson28-Jul-02 21:27
sitebuilderPaul Watson28-Jul-02 21:27 
GeneralRe: help needed...!!! Pin
SimonS28-Jul-02 21:50
SimonS28-Jul-02 21:50 
GeneralRe: help needed...!!! Pin
Colin Leitner28-Jul-02 23:04
Colin Leitner28-Jul-02 23:04 
QuestionFile Manager in ASP?? Pin
dannytired26-Jul-02 6:13
sussdannytired26-Jul-02 6:13 
AnswerRe: File Manager in ASP?? Pin
Philip Patrick26-Jul-02 23:34
professionalPhilip Patrick26-Jul-02 23:34 
Generalrot N encryption using Javascript Pin
'Anil' Radhakrishna25-Jul-02 19:48
'Anil' Radhakrishna25-Jul-02 19:48 
GeneralRe: rot N encryption using Javascript Pin
Colin Leitner26-Jul-02 2:43
Colin Leitner26-Jul-02 2:43 
The rot N algorithm is one of the oldest methods to encrypt text (maybe 3000 years old). Take the english alphabet for eaxample, which has 26 characters.
If you move every character 5 digits above your 'a' would become an 'f'. Easy. Now what about the 'v'? Adding 5 digits to 'v' would result in the 27th character of your alphabet, wich is not defined. Now how can you solve this? Quite easy, because you moved the 'a' five digits up, you get a space of 5 digits at the beginning of your alphabet, so all shifted characters above 26 resume at the beginning of the alphabet.

Every ASCII character has 256 possible values, so you have to set the cutting edge to 256.

This function rotates your text n wise:
<nobr>function rot(text, n)
{
  var result = "", character, position;
  n = (n % 0xFF < 0) ? (0xFF + n % 0xFF) : (n % 0xFF);    // rotating -10 is the same as rotating +245
  for (position = 0; position < text.length; position++)
  {
    character = text.charCodeAt(position);
    character = (character + n) % 0xFF;
    result += String.fromCharCode(character);
  }
  return result;
}


I wonder how you get an 'a' by adding something to 'i'. 'a' has the value 97 and 'i' the value 105?!

Ok, after sleeping over it twice I found 2 errors in my first try:
1. Negative n values, that resultet in a character value < 0 created garbage.
2. Numbers > 255 (0xFF) could also create problems.

Both fixed.
GeneralRe: rot N encryption using Javascript Pin
alex.barylski26-Jul-02 7:41
alex.barylski26-Jul-02 7:41 
GeneralRe: rot N encryption using Javascript Pin
Colin Leitner26-Jul-02 8:14
Colin Leitner26-Jul-02 8:14 
QuestionDatabase security...? Pin
alex.barylski25-Jul-02 17:16
alex.barylski25-Jul-02 17:16 
AnswerRe: Database security...? Pin
Jeremy Falcon26-Jul-02 6:25
professionalJeremy Falcon26-Jul-02 6:25 
Questionhow to use Tree view Pin
Mustafai25-Jul-02 11:30
Mustafai25-Jul-02 11:30 
GeneralPublishing ASP.NET from VS.NET Pin
afronaut25-Jul-02 11:00
afronaut25-Jul-02 11:00 
Generaljavascript and forms Pin
Anonymous25-Jul-02 9:41
Anonymous25-Jul-02 9:41 
GeneralRe: javascript and forms Pin
alex.barylski25-Jul-02 17:01
alex.barylski25-Jul-02 17:01 
GeneralRe: javascript and forms Pin
l a u r e n27-Jul-02 1:43
l a u r e n27-Jul-02 1:43 
GeneralDSN Connection Pin
Pradhip25-Jul-02 7:49
Pradhip25-Jul-02 7:49 
GeneralRe: DSN Connection Pin
Philip Patrick26-Jul-02 23:37
professionalPhilip Patrick26-Jul-02 23:37 
QuestionForm processing with HTML embedded langs...??? Pin
alex.barylski24-Jul-02 23:59
alex.barylski24-Jul-02 23:59 
AnswerRe: Form processing with HTML embedded langs...??? Pin
benjymous25-Jul-02 0:52
benjymous25-Jul-02 0:52 
GeneralRe: Form processing with HTML embedded langs...??? Pin
alex.barylski25-Jul-02 16:55
alex.barylski25-Jul-02 16:55 
QuestionASP + ORacle Functions? Pin
Anonymous24-Jul-02 5:28
Anonymous24-Jul-02 5:28 
AnswerRe: ASP + ORacle Functions? Pin
Nick Parker24-Jul-02 16:54
protectorNick Parker24-Jul-02 16:54 
GeneralHTML Forms Pin
jerry0davis24-Jul-02 0:51
jerry0davis24-Jul-02 0:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.