crypto安装_CryptoPP库在Linux系统下的安装与测试
生活随笔
收集整理的這篇文章主要介紹了
crypto安装_CryptoPP库在Linux系统下的安装与测试
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
CryptoPP庫在Linux系統下的安裝方法比較簡單,具體如下:
(1)解壓源代碼壓縮包
unzip –a cryptopp700.zip此處安裝的CryptoPP庫版本為7.0.0。
(2)執行編譯鏈接操作,生成庫文件
make(3)安裝CryptoPP庫
sudo make install此操作會將已生成的庫文件和源代碼中的頭文件復制到系統的相應目錄下。
(4)創建一個名為test.cpp的測試程序,輸入如下測試代碼:
#include#includeusing namespace std;using namespace CryptoPP;int main(){ if (LibraryVersion() != HeaderVersion()) { cout << "Potential version mismatch." << endl; const int lmaj = (LibraryVersion() / 100U) % 10; const int lmin = (LibraryVersion() / 10U) % 10; const int hmaj = (HeaderVersion() / 100U) % 10; const int hmin = (HeaderVersion() / 10U) % 10; if(lmaj != hmaj) cout << "Major version mismatch." << endl; else if(lmin != hmin) cout << "Minor version mismatch." << endl; } else { cout << LibraryVersion() << endl; cout << "Major and minor version both match." << endl; } return 0;}(5)編譯test.cpp程序,生成可執行程序test.exe
g++ test.cpp -o test.exe -lcryptopp(6)執行test.exe程序
./test.exe程序輸出結果如下:
700Major?and?minor?version??both?match.本教程介紹了CryptoPP庫在Linxu下的安裝,關于Windows下用Visual Studio C++的安裝方法詳見《深入淺出CryptoPP密碼學庫》或其他網絡資源。如果想了解CryptoPP庫的更多安裝方法,詳見源代碼文件下的install.txt文件。
CryptoPP是一個用C++語言編寫的、開源的、免費的密碼程序庫,它也被稱作Crypto++或libcrypto++或libCryptoPP。該密碼程序庫被廣泛應用于學術界、開源項目、非商業項目以及商業項目。
Crypto++官網地址:https://www.cryptopp.com/
如果對密碼編程感興趣,可掃碼加入下面的微信群:
總結
以上是生活随笔為你收集整理的crypto安装_CryptoPP库在Linux系统下的安装与测试的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: redis 发布订阅实际案例_Redis
- 下一篇: python图书馆管理系统实验报告_基于