top of page
Search

[Assignment 2 - Mark Dolan Programming - Google Sites](^4^)



We will assume that the running time of multiplying n-bit numbers is M(n). According to problem 0.4 in Chapter 0, fib3 involves O(log n) arithmetic operations (multiplications). Since we are working in arithmetic mod p, each intermediate result will be log p bits long, therefore the total running time of fib3 is O(log(n) * M(log p)).


(a) Give an efficient algorithm that takes as input a number N and determines whether it is a square, that is, whether it can be written as q^2 for some positive integer q. What is therunning time of your algorithm?(b) Show that if N = q^k (with N, q, and k all positive integers), then either k




2^125 mod 127




(c)We first give an algorithm to determine if a n-bit number N is of the form q^k for some given k and q > 1. For this , we use the same algorithm of part (a) only instead of squaring, we will raise numbers to the k-th power and check if we obtain N. This will take O(n) iterations: moreover, each powering operation takes time at most the sum fro i = 1 to k (i*n*n) = O(k^2 * n^2) . Hence, one run of this algorithm takes time O(k^2 * n^3). To check if N is a power, we need to repeat this for all k


1.43. In the RSA cryptosystem, Alice's public key (N, e) is available to everyone. Suppose that her private key d is compromised and becomes known to Eve. Show that if e = 3 (a common choice) then Eve can efficiently factor N.


1.45. RSA and digital signatures. Recall that in the RSA public-key cryptosystem, each user has a public key P = (N, e) and a secret key d. In a digital signature scheme, there are two algorithms, sign and verify. The sign procedure takes a message and a secret key, then outputs a signature gamma. The verify procedure takes a public key (N, e), a signature gamma, and a message M, then returns "true" if gamma could have been created by sign (when called with message M and the secret key corresponding to the public key (N, e)); "false" otherwise.


(b) An RSA signature consists of sign(M, d) = M^d (mod N), where d is a secret key and N is part of the public key. Show that anyone who knows the public key (N, e) can performverify((N, e),M^d,M), i.e., they can check that a signature really was created by the private key. Give an implementation and prove its correctness.


(c) Generate your own RSA modulus N = pq, public key e, and private key d (you don't need to use a computer). Pick p and q so you have a 4-digit modulus and work by hand. Nowsign your name using the private exponent of this RSA modulus. To do this you will need to specify some one-to-one mapping from strings to integers in [0,N -1]. Specify any mappingyou like. Give the mapping from your name to numbers m1, m2, ..., mk, then sign the first number by giving the value m1^d (mod N), and finally show that (m1^d)^e = m1 (mod N).


b) verify((N, e),M^d,M) can be implemented by checking whether (M^d)^e mod N equals M. Then, if the signature was created by the private key d, we have (M^d)^e mod N = (M^e)^d mod N = M mod N = M, by the correctness of the RSA protocol. Conversely, if an adversary was able to sign given only (N, e), the adversary would be able to exponentiate by d mod N, which would allow him to decrypt, contradicting the security of the RSA protocol. Hence, if the RSA is secure, so is this scheme for digital signatures.


A good trick to avoid calculating the entire power in modular arithmetic problems like $$a^p \mod m$$ is to find a power of the same base eqa^q/eq such that $$a^q \equiv 1 \mod m$$ or such that $$a^q \equiv -1 \mod m$$ because eq1^q = 1/eq for all eqq/eq and eq(-1)^q = 1/eq for all even integer eqq/eq and eq(-1)^q = -1/eq for all integer odd eqq/eq.


Therefore, writing eqp = qs + r/eq for some integer eqs/eq, we have $$a^p \equiv a^qs+r \equiv (a^q)^s \cdot a^r \mod m$$ which is much easier to calculate since eq(a^q)^s/eq will be equal to eq1/eq or eq-1/eq, regardless of the value of eqs/eq.


To avoid calculating the entire power, let's look for a power of eq2/eq that leaves a remainder of eq1/eq or eq-1/eq when dividing by eq127/eq. Let's use eq2^7 = 128/eq since eq128 \equiv 1 \mod 127/eq.


$$\beginalign2^125 & \equiv 2^7(17) + 6 \mod 127 &\text[Applying the factorization of 125] \\& \equiv (2^7)^17\cdot 2^6 \mod 127 &\text[Applying the product of powers of the same base] \\& \equiv (1)^17\cdot 2^6 \mod 127 &\text[Since 2^7 \equiv 1 \mod 127] \\& \equiv 1\cdot 2^6 \mod 127 &\text[Since 1^7 =1] \\& \equiv 64 \mod 127 &\text[Applying 2^6 =64] \\& \equiv 64\endalign$$


The 127 mm (5")/54 caliber (Mk 45) lightweight gun is a U.S. naval artillery gun mount consisting of a 127 mm (5 in) L54 Mark 19 gun on the Mark 45 mount.[1] It was designed and built by United Defense, a company later acquired by BAE Systems Land & Armaments, which continued manufacture.


The latest 62-calibre-long version consists of a longer-barrel L62 Mark 36 gun fitted on the same Mark 45 mount.[1] The gun is designed for use against surface warships, anti-aircraft and shore bombardment to support amphibious operations.[1] The gun mount features an automatic loader with a capacity of 20 rounds. These can be fired under full automatic control, taking a little over a minute to exhaust those rounds at maximum fire rate. For sustained use, the gun mount would be occupied by a six-person crew (gun captain, panel operator, and four ammunition loaders) below deck to keep the gun continuously supplied with ammunition.


In sustained firing operations (Mode III), the gun is operated by a six-person crew: a gun captain, a panel operator, and four ammunition loaders, all located below decks. In fully automatic non-sustained firing operations (Mode IV), 20 rounds can be fired without any personnel inside the mount, using an automatic loader.


On 9 May 2014, the U.S. Navy released a request for information (RFI) for a guided 127 mm (5-inch) round that could be fired from Mark 45 guns on Navy destroyers and cruisers. The thinking is that if the technology worked in the 155 mm (6 in) Long Range Land Attack Projectile (LRLAP) for the Advanced Gun System on Zumwalt-class destroyers, it can be applied to a 127 mm (5-inch) mount. This RFI comes six years after the cancelation of the Raytheon Extended Range Guided Munition. The shell must have at least double the range of unguided shells for missions including Naval Surface Fire Support (NSFS)/Land Attack, and increasing anti-surface warfare (ASuW) capabilities against fast attack craft (FAC) and fast inshore attack craft (FIAC); the main purpose is to destroy incoming small boats at a greater range with a proximity fuse airburst blast fragmentation warhead to spray shrapnel over swarms.


This modulo calculator is a handy tool if you need to find the result of modulo operations. All you have to do is input the initial number x and integer y to find the modulo number r, according to x mod y = r. Read on to discover what modulo operations and modulo congruence are, how to calculate modulo and how to use this calculator correctly.


Modulo operations, in the case of the clock, are so intuitive we don't even notice them. In mathematics, there are many types of more elaborate modulo operations that require more thought. We can write down that:


Otherwise, the number r is the remainder of the division, where x is the dividend, and y is the divisor (our remainder calculator explains how to obtain the remainder of a division).


So, the modulo of the sum of two numbers is equal to the sum of the modulo of those numbers calculated separately, then multiplied by the modulo divisor. The first stage is made to get rid of the quotient part, and then the mod operation is used again. Have a look at the example:


Even faster modular exponentiation methods exist for some specific cases (if B is a power of 2). If you want to read about them and practice modular arithmetic, check out our dedicated power mod calculator.


However, modulo is not only used in a mathematical context. Sometimes you may hear it in everyday conversation, where it probably means ignoring, not accounting for something, with due allowance for something, e.g.,


Modulo operations are used to calculate the checksums of serial numbers. Check digits are used mostly in long numbers, and they are the digits computed by an algorithm. They are there to inform you about errors arising, e.g., from mistyping. You can find the application of modulo in the following:


That's exactly the case when you can use modulo! 10 mod 3 = 1. In other words, 10 divided by 3 equals 3, but it remains 1 slice left ?. That was not the most difficult example, but we hope you can see the usefulness of modulo.


By the way, have you seen our collection of pizza calculators? We have the amazing pizza party calculator, which can help to estimate how much pizza you need to order, and if you ever wondered if it's better to buy two medium pizzas or just one large, the pizza comparison calculator is a safe bet.


Oh, no! We're getting hungry. Let's leave this yummy distraction and go back to Earth. If you're interested in finding more funny applications of modular arithmetic, check out this betterexplained.com blog post.


The modulo operator is used to find the remainder during a division of two numbers. The operator is represented by the symbol % in most programming languages. It is also known as the remainder operator. As an example, 5 mod 2 returns 1.


The components of modulo division are dividend, divisor, quotient, and remainder. The remainder is the answer or end result of the operation.


Founded by the eyewear legend Cari Zalloni, Cazal has always broken new ground in their designs. Zalloni realised early on that people were looking for more than just sun protection with their sunglasses and so he began to deliver his signature style. The 80s led to the adoption of Cazal by numerous hip-hop legends like Darryl McDaniels of Run DMC, Joe Cooley and Rodney-O. Unleash your inner b-boy in a pair of vintage Cazal frames. 2ff7e9595c


0 views0 comments

Recent Posts

See All
bottom of page