Encrypt and decrypt data Security 1 OpenSSL installation
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/8B/5C/wKioL1hKxQbD5HIyAAAhMSiID1I733.png "title=" Openssl.png "alt=" Wkiol1hkxqbd5hiyaaahmsiid1i733.png "/>
OpenSSL official website:https://www.openssl.org/source/
Unzip, compile, install
Unzip Openssl[email protected]:~ $ cd openssl/[email Protected]:~/openssl $ tar XF openssl-1.1.0[email Protected]:~/openssl $ CD openssl-1.1.0/compilation environment check [email protected]:~/openssl/openssl-1.1.0 $./config [Email protected]:~/openssl/ openssl-1.1.0 $ echo $?0 start compiling [email protected]:~/openssl/openssl-1.1.0 $ make-j 8[email protected]:~/openssl/ openssl-1.1.0 $ echo $?0 start installation, note permissions [email protected]:~/openssl/openssl-1.1.0 $ sudo make install[email protected]:~/ openssl/openssl-1.1.0 $ echo $?0
Test:
[Email Protected]:~/openssl $ cat main.c #include <openssl/sha.h> #include <string.h> #include <stdio.h >int Main (int argc,char** str) {if (argc<2) {printf ("%s \" string\ "\ n", str[0]); return 0;} unsigned char outmd[20];//Note that the number of characters here is 20memset (outmd,0,sizeof (OUTMD)); Sha_ctx STX; Sha1_init (&STX); Sha1_update (&stx,str[1],strlen (str[1)); Sha1_final (OUTMD,&STX); int i;for (i=0;i<20;i++) {printf ("%02x", Outmd[i]);} printf ("\ n"); return 0;} [Email Protected]:~/openssl $ gcc main.c-l crypto-wall &&./a.out "Hello Linux OpenSSL" b15f046fca47459dfbc7b01b 11e4f1a6462847fc[email Protected]:~/openssl $
Verify that the program is correct: http://encode.chahuo.com/
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/8B/5C/wKioL1hKxi_jDCXUAABJ5A8E7X4994.png "title=" checksum. png "alt=" Wkiol1hkxi_jdcxuaabj5a8e7x4994.png "/>
This article is from the "Soul Bucket" blog, please be sure to keep this source http://990487026.blog.51cto.com/10133282/1881360
Encrypt and decrypt data security 1 OpenSSL installation