Abstract Algebra chapter 7
7.7:Encrypt each of the following RSA messages x so that x is divided into blocks of integers of length 2; that is, if x = 142528,encode 14,25,and 28 separately.
RSA加密方法:y=x^E mod n
计算时可采用重复乘方法(repeated squares)
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdio>
using namespace std; int binary[];
double mod[]; int main()
{
int n,E,x;
while ((cin>>n>>E>>x)&&n&&E&&x)
{
memset(binary,,sizeof(binary));
memset(mod,,sizeof(mod));
for (int i=;i>=;i--)
{
if (<<i <= E)
{
binary[i]=;
E-= (<<i);
}
if (E<=0.001) break;
}
mod[]=x%n;
for (int i=;i<sizeof(binary);i++)
{
mod[i]=fmod(pow(mod[i-],),n);
}
double temp = ;
for (int i=;i<sizeof(binary);i++)
{
if (binary[i]==)
{
temp = fmod(fmod(temp,n)*fmod(mod[i],n),n);
}
}
cout<<temp<<endl;
}
return ;
}
Abstract Algebra chapter 7的更多相关文章
- In abstract algebra, a congruence relation (or simply congruence) is an equivalence relation on an algebraic structure (such as a group, ring, or vector space) that is compatible with the structure in
https://en.wikipedia.org/wiki/Congruence_relation In abstract algebra, a congruence relation (or sim ...
- 《A First Course in Abstract Algebra with Applications》-chaper1-数论
由于笔者在别的专栏多次介绍过数论,这里在<抽象代数基础教程>的专栏下,对于chaper1数论这一章节介绍的方式不那么“入门”. 首先来介绍一个代数中常用也是非常重要的证明方法:数学归纳法. ...
- 《A First Course in Abstract Algebra with Applications》-chaper1-数论-棣莫弗定理
定理1.24 (棣莫弗定理) 对每个实数x和每个正整数n有 基于棣莫弗定理的推论如下:
- 《A First Course in Abstract Algebra with Applications》-chaper1-数论-关于素数
由于笔者在别的专栏多次介绍过数论,这里在<抽象代数基础教程>的专栏下,对于chaper1数论这一章节介绍的方式不那么“入门”. 首先来介绍一个代数中常用也是非常重要的证明方法:数学归纳法. ...
- 软件工程卷1 抽象与建模 (Dines Bjorner 著)
I 开篇 1. 绪论 II 离散数学 2. 数 (已看) 3. 集合 4. 笛卡尔 5. 类型 6. 函数 7. λ演算 8. 代数 9. 数理逻辑 III 简单RSL 10. RSL中的原子类型和值 ...
- MIT牛人解说数学体系
https://www.douban.com/group/topic/11115261/ 在过去的一年中,我一直在数学的海洋中游荡,research进展不多,对于数学世界的阅历算是有了一些长进. 为什 ...
- 【zz】MIT牛人解说数学体系
作者:林达华 一.为什么要深入数学的世界 作为计算机的学生,我(原作者)没有任何企图要成为一个数学家.我学习数学的目 的,是要想爬上巨人的肩膀,希望站在更高的高度,能把我自己研究的东西看得更深广一些. ...
- MIT牛人解说数学体系(转载)
原文网址:http://www.guokr.com/post/442622/ 在过去的一年中,我一直在数学的海洋中游荡,research进展不多,对于数学世界的阅历算是有了一些长进. 为什么要深入数学 ...
- Mathematics for Computer Graphics数学在计算机图形学中的应用 [转]
最近严重感觉到数学知识的不足! http://bbs.gameres.com/showthread.asp?threadid=10509 [译]Mathematics for Computer Gra ...
随机推荐
- org.apache.flume.FlumeException: NettyAvroRpcClient { host: xxx.xxx.xxx.xxx, port: 41100 }: RPC
2014-12-19 01:05:42,141 (lifecycleSupervisor-1-1) [WARN - org.apache.flume.sink.AbstractRpcSink.star ...
- Ajax 学习之获取服务器的值
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- Revit二次开发示例:DesignOptions
本例只要演示Revit的类过滤器的用法,在对话框中显示DesignOption元素. #region Namespaces using System; using System.Collections ...
- JavaScript 开发进阶:理解 JavaScript 作用域和作用域链
作用域是JavaScript最重要的概念之一,想要学好JavaScript就需要理解JavaScript作用域和作用域链的工作原理.今天这篇文章对JavaScript作用域和作用域链作简单的介绍,希望 ...
- HDU 3065 (AC自动机模板题)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=3065 题目大意:多个模式串,范围是大写字母.匹配串的字符范围是(0~127).问匹配串中含有哪几种模 ...
- Resume简历中装B的词汇总结大全
1. Accelerated 35. Empowered 69. Motivated 2. Accomplished 36. Enabled 70. Negotiated 3. Achieved 37 ...
- MS14-068 privilege escalation PoC: 可以让任何域内用户提升为域管理员
https://github.com/bidord/pykek ms14-068.py Exploits MS14-680 vulnerability on an un-patched domain ...
- java--测体重练习
public class tz{ public static void main(String[] args){ int sg=165,tz=52;bz = sg-115 if (tz-bz>3 ...
- Office 2010 KMS激活原理和案例分享 - Your Office Solution Here - Site Home - TechNet Blogs
[作者:葛伟华.张玉工程师 , Office/Project支持团队, 微软亚太区全球技术支持中心 ] 为了减低部署盗版(可能包含恶意软件.病毒和其他安全风险)的可能性,Office 2010面向企 ...
- 【转】bShare分享插件的使用
原文地址:http://blog.csdn.net/pan_junbiao/article/details/17884203 1.引用JS文件 分享标签: 1.class="bshare-c ...