miracl linux下载tar,libOTe配置帮助文档(Linux下)

确保自己电脑上已安装Linux系统 如果没有请看准备阶段

一、准备

1、进入控制面板―>程序―>打开启用或者关闭Windows功能

032d886ba08a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

图片发自简书App

032d886ba08a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

图片发自简书App

2、进入启用或关闭Windows功能后  勾选 适用于Linux的Windows子系统  点击确定

032d886ba08a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

图片发自简书App

3、进入设置->更新和安全->开发者选项 并勾选开发人员模式(目的让Windows运行外来的、可能不安全程序)

032d886ba08a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

图片发自简书App

032d886ba08a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

图片发自简书App

4 进入Microsoft Store应用商店 下载Ubuntu系统

032d886ba08a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

图片发自简书App

5、安装后打开会出现创建用户和密码  相当于Windows创建用户

二、配置基础LibOTe

1、首先确保编译器已安装 (OTe是用C++写的)sudo apt-get install gcc g++  cmake -y

2 、克隆libOTegit clone --recursive https://github.com/osu-cryto/libOTe.git

3、 下载解压boostcd libOTe/cryptoTools/thirdparty/linuxwget -c 'https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.bz2' -O ./boost_1_69_0.tar.bz2tar xfj boost_1_69_0.tar.bz2mv boost_1_69_0 boost

4、编译链接boost库cd boost./bootstrap.shsudo ./b2 stage --with-system --with-thread link=static -mt

5、下载安装miracl(安装在libOTe/cryptoTools/thirdparty/linux下面)cd..git clone https://github.com/ladnir/miraclcd miracl/miracl/source/sudo bash linux64

在执行sudo bash linux64 时会出现这种情况 不必理会

032d886ba08a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

图片发自简书App

6、切换至libOTe目录下cd ../../../../../../cmake . -DENABLE_MIRACL=ON

032d886ba08a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

图片发自简书App

7 、执行命令 make  (中间出现警告不用管)

032d886ba08a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

图片发自简书App

8、测试

进入bin目录下的frontend_libOTe 会出现参数表 根据相应的参数来验证./bin/frontend_libOTe

032d886ba08a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

图片发自简书App./bin/frontend_libOTe -u

032d886ba08a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

图片发自简书App

出现(SKipped……)因为没有安装快速OTe  到此完成了基础OT的安装

三、快速OT安装

1、下载安装relic(安装在libOTe/cryptoTools/thirdparty/linux下面)git clone https://github.com/relic-toolkit/relic.gitreliccmake . -DMULTI=OPENMPmakesudo make install

2、切换至libOTe下 编译安装libOTecmake . -DENABLE_RELIC=ONmake

3、测试./bin/frontend_libOTe -u

032d886ba08a?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

图片发自简书App

至此快速OT配置完成

我是个小白配置这个花了很大时间 ,请教了我的学长,最终才配制完成

如果有什么错误请大佬指点

参考资料  https://github.com/osu-crypto/libOTe

未经允许禁止抄袭 谢谢

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是使用miracl库在C语言中实现BLS签名的示例代码: ```c #include <stdio.h> #include <stdlib.h> #include "miracl.h" #define BLS_CURVE "BLS381" // 使用的椭圆曲线名称 int main() { // 初始化miraclmiracl* mip = mirsys(1000, 16); mip->IOBASE = 16; // 初始化BLS曲线参数 epoint* P = epoint_init(); Big q = mirvar(0); Big r = mirvar(0); Big h = mirvar(0); char* param = BLS_CURVE; ecurve_init(param, q, r, h, 1); epoint_copy(&CURVE_G_POINT, P); // 生成私钥 Big sk = mirvar(0); strong_bigrand(mip, q, sk); // 计算公钥 epoint* pk = epoint_init(); ecurve_mult(sk, P, pk); // 签名消息 char* msg = "hello, world!"; Big m = mirvar(0); mip->IOBASE = 256; cinstr(m, msg); mip->IOBASE = 16; Big sig = mirvar(0); ehashit(mip, SHA2, -1, msg, strlen(msg), sig); epoint* s = epoint_init(); ecurve_mult(sig, P, s); // 输出结果 printf("private key: %s\n", big_to_str(sk, NULL, 16)); printf("public key: %s\n", epoint_to_str(pk, NULL, 16)); printf("message: %s\n", msg); printf("signature: %s\n", epoint_to_str(s, NULL, 16)); // 释放资源 mirkill(sk); mirkill(q); mirkill(r); mirkill(h); epoint_free(P); epoint_free(pk); epoint_free(s); mirkill(sig); mirkill(m); mirkill(mip); return 0; } ``` 该示例中使用的是BLS381曲线,私钥使用随机数生成,公钥通过私钥和基点P的乘法计算得到。签名时,首先使用哈希函数计算消息的哈希值,然后将哈希值作为标量乘以基点P得到签名的点S。最后输出私钥、公钥、消息和签名的点。注意,在实际应用中,为了安全性,应该使用更安全的哈希函数,例如SHA-3。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值