Create my own PHP encryption

Asked

Viewed 880 times

1

I’d like to know the logic of an algorithm to encrypt and decrypt using PHP.

How to create my own encryption?

Ex. |Stack| -> |AlbNU|

  • How to do this?
  • It is possible ?
  • 2

    http://answall.com/search?q=como+funciona+criptografia

  • 6

    There are a lot of ways to do cryptography. Some good, some bad. Every day someone invents a bad way. Good forms have to have a very strong mathematical foundation to work.

  • @rray & Bacco. I know it’s a broad question and there are several websites containing information about encryption. Más recorri ao Stack. 'Cause next to you I’d like to know how to create a simple and I believe it will help many people!

  • 4

    It’s going to help a lot of people screw up, one of the basic rules for cryptography is not to invent one. (But this is just an observation, the vote of broad does not have to do with this, but the fact that it has to be more specific, or it can not answer - starting with what you understand by cryptography, and what objective to be achieved).

  • @Bacco with the 'Help many people' I meant that many have doubts and desire to create their own encryption just for study and testing! not that they will do the encryption and play in a client registration system!

  • 2

    My suggestion is to do a search in the already existing questions, as the search link above, and in this post here (see the various answers): http://answall.com/questions/2402/70 - then, with the concepts you get, you can [Edit] your question and make it cooler. Then I think you’ll be of more help, and get some useful answers. The problem is that as it is, many answers are possible spanning many different angles on the subject, which is extensive, and none serve your goal.

  • 1

    I wanted to explain the foundation with a simple code, but some people are negative... So I’m just sorry...

  • 1

    // Imagine that you have all characters here A, B, C ..., a, b, c ... $cipher original = array("S","t","a","c","k"); // And here you have matching letters that will exchange $Trocaletters = array("A","l","b","N","U"); $word = "|Stack|"; $palavra_modified = str_replace( $cifraoriginal, $Trocaletras, $palavra ); echo $palavra_modified; Now imagine that every time you have a "de" sequence, you want it to be replaced by "K", then you do another replace, and so on..

  • 2

    @Antonioalexandrealonsodesi I think I have one of those cipher in some response, if I find the link, colo here in the comments as a complement. PS: The negative was not mine, but between cipher and cryptography as it is understood in IT, it has a huge abyss. For general purposes a cipher is a form of cryptography, but this as an academic notion. I think it’s nice to make that clear when you answer something like this, so the reader can understand the context.

  • @Bacco I had put a comment but deleted because I could not put the explanation together by character limit in the comment. https://pt.wikipedia.org/wiki/Cifra_de_replaces%C3%A7%C3%A3o

  • 1

    Anything you do with any content that makes it unreadable, and you can undo later, is encryption. So it’s hard to answer that question of yours.

Show 7 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.