Questions tagged [encryption-symmetric]

A type of encryption where the same key is used to encrypt and decrypt the message.

Symmetric encryption is the oldest and best-known technique. A secret key, which can be a number, a word, or just a string of random letters, is applied to the text of a message to change the content in a particular way. This might be as simple as shifting each letter by a number of places in the alphabet (known as the Caesar Cipher), or as complicated as the Advanced Encryption Standard, which is used in some modern cryptography. Anyone who knows the key can either encrypt or decrypt a message.

Note that symmetric encryption does not require that the encryption and decryption key be identical, but rather that both keys derive from the same knowledge. For example, a letter-shifting cipher might require that "A" be enciphered as "G" - the opposite operation would be needed to decrypt.

736 questions
277
votes
6 answers

Simplest two-way encryption using PHP

What is the simplest way of doing two way encryption in common PHP installs? I need to be able to encrypt data with a string key, and use the same key to decrypt on the other end. The security isn't as big of a concern as the portability of the…
user1206970
  • 2,797
  • 3
  • 14
  • 4
275
votes
10 answers

How do you Encrypt and Decrypt a PHP String?

What I mean is: Original String + Salt or Key --> Encrypted String Encrypted String + Salt or Key --> Decrypted (Original String) Maybe something like: "hello world!" + "ABCD1234" --> Encrypt --> "2a2ffa8f13220befbe30819047e23b2c" (may be, for…
夏期劇場
  • 17,821
  • 44
  • 135
  • 217
119
votes
6 answers

How to encrypt/decrypt data in php?

I'm currently a student and I'm studying PHP, I'm trying to make a simple encrypt/decrypt of data in PHP. I made some online research and some of them were quite confusing(at least for me). Here's what I'm trying to do: I have a table consisting of…
Randel Ramirez
  • 3,671
  • 20
  • 49
  • 63
67
votes
10 answers

PHP AES encrypt / decrypt

I found an example for en/decoding strings in PHP. At first it looks very good but it wont work :-( Does anyone know what the problem is? $Pass = "Passwort"; $Clear = "Klartext"; $crypted = fnEncrypt($Clear, $Pass); echo "Encrypted:…
Andreas Prang
  • 2,187
  • 4
  • 22
  • 33
46
votes
4 answers

Differences Between Rijndael and AES

I'm investigating encryption algorithms - can someone give me a quick rundown of the differences between Rijndael and AES?
Peter
  • 37,042
  • 39
  • 142
  • 198
42
votes
3 answers

Really simple encryption with C# and SymmetricAlgorithm

I'm looking for a very simple crypt / decrypt method. I will be using always the same static key. I'm aware of the risks of this approach. Currently I'm using the following code but it does not generate the same result after crypting and decripting…
Ignacio Soler Garcia
  • 21,122
  • 31
  • 128
  • 207
35
votes
9 answers

Simple Encryption in Ruby without external gems

I need a simple encryption for some text strings. I want to create coupon codes and make them look cool so subsequently created code should look very different. (And besides looking cool, it shouldn't be easy to guess a code.) But I want to be able…
Philip
  • 3,470
  • 7
  • 29
  • 42
35
votes
11 answers

Symmetric Bijective Algorithm for Integers

I need an algorithm that can do a one-to-one mapping (ie. no collision) of a 32-bit signed integer onto another 32-bit signed integer. My real concern is enough entropy so that the output of the function appears to be random. Basically I am looking…
Emre Yazici
  • 10,136
  • 6
  • 48
  • 55
28
votes
5 answers

AES-256 encryption in PHP

I need a PHP function, AES256_encode($dataToEcrypt) to encrypt the $data into AES-256 and another one AES256_decode($encryptedData) do the opposite. Does anyone know what code should this functions have?
mariannnn
  • 287
  • 1
  • 3
  • 4
23
votes
2 answers

Symmetric Encryption (AES): Is saving the IV and Salt alongside the encrypted data safe and proper?

I am trying to make sense of how to handle and manage an initilization vector and salt (when applicable) when encrypting and decrypting data using a symmetric encryption algorithm, in this case AES. I have deduced from different SO threads and…
Caster Troy
  • 2,796
  • 2
  • 25
  • 45
18
votes
1 answer

HTTPS uses Asymmetric or Symmetric encryption?

I have searched all this morning but I've found websites where it is said that data is sent through an asymmetric encryption using the TLS protocol Then I found the contrary Please can you tell me which is true? Thanks And does anyone know a guide…
18
votes
2 answers

C# Encryption to PHP Decryption

I'm trying to encrypt some (cookie) data in C# and then decrypt it in PHP. I have chosen to use Rijndael encryption. I've almost got it working, except only part of the text is decrypted! I started working from this example: Decrypt PHP encrypted…
solidau
  • 4,021
  • 3
  • 24
  • 45
17
votes
1 answer

Is it insecure to pass initialization vector and salt along with ciphertext?

I'm new to implementing encryption and am still learning basics, it seems. I have need for symmetric encryption capabilities in my open source codebase. There are three components to this system: A server that stores some user data, and…
Sandy
  • 1,968
  • 14
  • 25
16
votes
7 answers

What is the performance difference of pki to symmetric encryption?

We are looking to do some heavy security requirements on our project, and we need to do a lot of encryption that is highly performant. I think that I know that PKI is much slower and more complex than symmetric encryption, but I can't find the…
15
votes
3 answers

How exactly does encryption key rotation work?

How exactly does encryption key rotation work? I understand it's a very good practice to continuously rotate your encryption keys for security purposes, but rotating a key would require too much work. Case: Let's just say I have a database storing…
1
2 3
48 49