Click here to Skip to main content
15,886,835 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Line Intersection Pin
dasblinkenlight17-Jun-11 5:51
dasblinkenlight17-Jun-11 5:51 
GeneralRe: Line Intersection Pin
musefan17-Jun-11 5:55
musefan17-Jun-11 5:55 
AnswerRe: Line Intersection Pin
Roger Wright17-Jun-11 20:34
professionalRoger Wright17-Jun-11 20:34 
GeneralRe: Line Intersection Pin
musefan21-Jun-11 0:12
musefan21-Jun-11 0:12 
AnswerRe: Line Intersection Pin
BobJanova20-Jun-11 23:41
BobJanova20-Jun-11 23:41 
GeneralRe: Line Intersection Pin
musefan21-Jun-11 0:08
musefan21-Jun-11 0:08 
QuestionPattern Cracking Question Pin
YSLGuru16-Jun-11 12:57
YSLGuru16-Jun-11 12:57 
AnswerRe: Pattern Cracking Question Pin
Moreno Airoldi17-Jun-11 22:52
Moreno Airoldi17-Jun-11 22:52 
Ok let's see if I can come up with something, sounds fun! Smile | :)

The hints we can gather from the given puzzle parameters are:

1) It seems we're talking ASCII characters, one byte per character and a well-known codification.

2) A maximum length of 12 chars, ok.

3) Putting together this with what I see in point 4, it seems the encrypted 2-character data seems to represent a byte value in hex (examples are "57" an "0A", both valid hex byte values).

4) So, the character position in the input string is the second variable to take into account (the first is the character ASCII code itself, see point 1).

5) This confirms what I said for points 1, 3 and 4.

So, we want to find an operation "op" which, applied to the two variables (character code and position) gives us the resulting hex code.

Now let's have a look at the examples we find in point 4.
We know that the ASCII code for "a" is decimal 97, hex 61h, so:

61h op 01h = 57h
61h op 08h = 0Ah

(where 01h and 08h are the character positions in the example, of course)
Let's have it in binary and decimal too, it will be useful:

0110 0001 op 0000 0001 = 0101 0111
0110 0001 op 0000 1000 = 0000 1010

97 op 1 = 87
97 op 8 = 10

Now, one interesting thing we can see is there seems to be a symmetrical relation between the three values:

97 - 10 = 87

This hints at a relation where the only variable is the character position (1 or 8).
So, let't try to find an operation which transforms our equation system in:

97 - 10 = 87
97 - 87 = 10

Looking at the binary representation of 87 and 10, I can seen that if I shift 87 three digits to the right I obtain 10 (0101 0111 shr 3 = 0000 1010).

So, one possibile solution for the puzzle is:

1) Take the charater's ASCII code ("a" = 97)

2) Subtract 10 (97 - 10 = 87)

3) Shift the resulting byte to the right by a number of digits equal to the character's position plus 2, where the first position in the input string is 1, but if the number of digits to shift is 10 or more, subtract 10. (so, 1 + 2 = 3 -> shr 3 ; 8 + 2 = 10 -> 10 - 10 = 0 -> shr 0).

3) Subtract the resulting byte from the character's ASCII code (so, 97 - 10 = 87 ; 97 - 87 = 10).

While this works for the two given examples, it's a very weak explanation. For example, what I say in point 3 can work in other ways too, and still give the correct results.

Maybe someone who is more experienced in cryptography than me will come up with a better solution.

Hope this can somehow help you, it sure was fun for me! Wink | ;)
2+2=5 for very large amounts of 2
(always loved that one hehe!)

AnswerRe: Pattern Cracking Question Pin
dasblinkenlight20-Jun-11 9:36
dasblinkenlight20-Jun-11 9:36 
AnswerRe: Pattern Cracking Question Pin
musefan21-Jun-11 0:34
musefan21-Jun-11 0:34 
GeneralRe: Pattern Cracking Question Pin
YSLGuru21-Jun-11 10:41
YSLGuru21-Jun-11 10:41 
GeneralRe: Pattern Cracking Question Pin
BobJanova22-Jun-11 0:33
BobJanova22-Jun-11 0:33 
GeneralRe: Pattern Cracking Question Pin
musefan22-Jun-11 3:34
musefan22-Jun-11 3:34 
GeneralRe: Pattern Cracking Question Pin
BobJanova22-Jun-11 4:34
BobJanova22-Jun-11 4:34 
Questionmerge k AVL trees complexity Pin
Hesham Yassin16-Jun-11 0:14
Hesham Yassin16-Jun-11 0:14 
AnswerRe: merge k AVL trees complexity Pin
Alan Balkany16-Jun-11 5:13
Alan Balkany16-Jun-11 5:13 
GeneralRe: merge k AVL trees complexity Pin
dasblinkenlight17-Jun-11 10:10
dasblinkenlight17-Jun-11 10:10 
AnswerRe: merge k AVL trees complexity Pin
dasblinkenlight17-Jun-11 10:08
dasblinkenlight17-Jun-11 10:08 
GeneralRe: merge k AVL trees complexity Pin
Hesham Yassin17-Jun-11 10:49
Hesham Yassin17-Jun-11 10:49 
QuestionEye-like Algorithm Pin
JustWorking14-Jun-11 2:46
JustWorking14-Jun-11 2:46 
AnswerRe: Eye-like Algorithm Pin
phil.o14-Jun-11 3:39
professionalphil.o14-Jun-11 3:39 
GeneralRe: Eye-like Algorithm Pin
JustWorking14-Jun-11 4:07
JustWorking14-Jun-11 4:07 
GeneralRe: Eye-like Algorithm Pin
Alan Balkany14-Jun-11 4:51
Alan Balkany14-Jun-11 4:51 
GeneralRe: Eye-like Algorithm Pin
JustWorking14-Jun-11 20:27
JustWorking14-Jun-11 20:27 
QuestionPolygons from Points Pin
Kyudos31-May-11 15:28
Kyudos31-May-11 15:28 

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.