2

Text: apple Pass: password

openssl aes-256-cbc -e -a -in  apple.txt

Output: U2FsdGVkX1/sqDrVkgk/7dKiCfLW+1/bgvRT/YAopJQ=

gpg -c --cipher-algo AES256 apple.txt

Output: A0ECQMCvDw3qeyQxgNg0kABv5nE4IDtSYmDTJudbl55d0GjBkiLd1B4sgbY/QQPVJX/uaHuDIb9 xhcwW/7UaxIxh9URhkHPni2IhYoOuKqm

How to sync out the two results?

1
  • 1
    Both of these tools internally use AES256, but their output formats are completely different. Can you be more specific about what you're trying to do? Do you really need deterministic encryption where the same input always produces the same output? Mar 8, 2012 at 13:35

2 Answers 2

1

The openssl command is salting your input and putting it in an OpenSSL encryption container. You could use the -nosalt option, but it will reduce the security of your encryption. I know less about the gpg command, but I'm pretty sure it's doing something similar. Its output is far too large to be just the word "apple" encrypted.

1

Event if you use the same command different times you'll have different outputs. The reason is that every time a new AES-256 key is generated and protected with your pass-phrase.

openssl aes-256-cbc -e -a -in  password.txt
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
U2FsdGVkX19yNQwed5/Sq3b6/3UFGGOGVD1dSA7aCZI=

openssl aes-256-cbc -e -a -in  password.txt
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
U2FsdGVkX19rulpZRi8u5K9iJKVN5FVFRb6ngFY1BWM=

openssl aes-256-cbc -e -a -in  password.txt
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
U2FsdGVkX192MxevxHvc1wW0dh9P4HctQF/75HEPVB4=

openssl enc -aes-256-cbc -k test -P
salt=667E42EDE61BEA35
key=46FB1D91FC400A8E26A8B0E38CF505F026263299CF0FA541217FBC6CEED1FC0B
iv =10A3858EC9D718AB91FC45B98786FDCC

openssl enc -aes-256-cbc -k test -P
salt=34F9B481E391A831
key=CDF1D936F99147BB56B4E3441B5E1A68A15838FE43F234AA7EB9A9F903B0BD61
iv =A649443D096E6976420F4941C2608CC8

openssl enc -aes-256-cbc -k test -P
salt=51AC4B4388D5C25B
key=D70AF8238D1C597F074123C9BB23B76C9CA04AAF2C986C4A56F96CB0FF1365F9
iv =D70FB991EEE776FCD45A67830CBD3202

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .