如何用vs2015编译与使用libtomcrypt

流程:

从github下载libtomcrypt,解压它,使用vs2015打开libtomcrypt_VS2008.sln,然后重新生成项目,得到lib静态库。
得到了lib库,就能直接在自己的项目中使用了,具体使用方式可以参考解决方案2。

问题1:

报错:
the LTC_FAST hack is only available on compilers that support attribute((may_alias)) - disable it for your compiler, and dont worry, it won`t buy you much anyway

这里写图片描述

解决方案1:

编译器不支持LTC_FAST,那就在tomcrypt_cfg.h中找到LTC_FAST的define,都替换成LTC_NO_FAST。
这里写图片描述


问题2:

这里写图片描述

解决方案2:

缺少相应的头文件,说明libtomcrypt中没有数学处理的函数包,则从github下载tommath,通过vs2015编译生成lib静态库,然后在libtomcrypt项目中加入该静态库,需要配置vc++目录,如下:
这里写图片描述

其中包含目录头文件所在的目录,库目录lib所在目录,接着在库管理器中,附加依赖项中添加该lib,如下:
这里写图片描述

注意:
如果是在实际项目中引用lib,附加依赖项在链接器输入目录下,如下:
这里写图片描述

参考:
在VS2010项目中引用Lib静态库

LibTomCrypt is a fairly comprehensive, modular and portable cryptographic toolkit that provides developers with a vast array of well known published block ciphers, one-way hash functions, chaining modes, pseudo-random number generators, public key cryptography and a plethora of other routines. LibTomCrypt has been designed from the ground up to be very simple to use. It has a modular and standard API that allows new ciphers, hashes and PRNGs to be added or removed without change to the overall end application. It features easy to use functions and a complete user manual which has many source snippet examples. LibTomCrypt is free for all purposes under the public domain. This includes commercial use, redistribution and even branching. Sports the following Public domain and open source. Written entirely in portable ISO C source (except for things like RNGs for natural reasons) Builds out of the box on virtually every box. All that is required is GCC for the source to build. Includes a 180+ page user manual in PDF format (with working examples in it) Block Ciphers Ciphers come with an ECB encrypt/decrypt, setkey and self-test interfaces. All ciphers have the same prototype which facilitates using multiple ciphers at runtime. Some of the ciphers are flexible in terms of code size and memory usage. Ciphers Supported. Blowfish XTEA RC5 RC6 SAFER+ Rijndael (aka AES) Twofish SAFER (K64, SK64, K128, SK128) RC2 DES, 3DES CAST5 Noekeon Skipjack Anubis (with optional tweak as proposed by the developers) Khazad KASUMI SEED Chaining Modes Modes come with a start, encrypt/decrypt and set/get IV interfaces. Mode supported. ECB CBC OFB CFB CTR IEEE LRW mode F8 Chaining Mode One-Way Hash Functions Hashes come with init, process, done and self-test interfaces. All hashes use the same prototypes for the interfaces. Hashes supported. MD2 MD4 MD5 SHA-1 SHA-224/256/384/512 TIGER-192 RIPE-MD 128/160/256/320 WHIRLPOOL Message Authenticat
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值