Jump to content

One way algorithms?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
How can it be that an algorithm is not reversable? Something like having a formula outputting a number for example 123456 and taking only the 1,3,5,6 (result would be 1356) would make it one way?

or what?

Thanks.

#2
G_Morgan

G_Morgan

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 537 posts
Some algorithms are reversible, others aren't.

Take a list. A reverse function is clearly reversible. (1 2 3) => (3 2 1) => (1 2 3). On the other hand the sum of a list isn't (1 2 3) => 6 => ???

//edit - the issue is - does the algorithm destroy data. Often the algorithm destroys some sort of data in the way it processes in order to more explicitly produce more useful information. In the second example, the value 6 is implicit in the list (1 2 3) given the plus operation. After the operation the value 6 is made explicit but the list is lost. Of course all relevant languages allow you to pass in copies so that both are maintained.//

#3
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Yeah man, you are right. Thanks for the explanation.. I was thinking this was something way more complicated!

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Getting a little more technical:

Every algorithm is, in essence, a function. If it is a one-to-one function, then it has an inverse which can be used to go from the output to the input. If it is a many-to-one function, then it does not have an inverse, and you can not reconstruct the input from the output.

Encryption is one-to-one (given a key).
Hashes are many-to-one.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
So if you encrypt some text with a many-to-one algorithm, you cannot get your original text back.. right?

#6
G_Morgan

G_Morgan

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 537 posts

TheComputerMaster said:

So if you encrypt some text with a many-to-one algorithm, you cannot get your original text back.. right?

Aye because you've destroyed information in the process.

It gets more complicated. Some algorithms are simple reversals, Enigma worked like this. Encryption tends to focus more on asynchronous encryption these days where differing keys and algorithms are used to encrypt and decrypt.

#7
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Correct,
Many-to-one algorithms are generally called 'hash functions'. MD5 and CRC are examples of these.

Dual key encryption uses some sneaky number theory results on prime powers to work.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog