I want to calculate the S-box for AES. But I have a problem with the multiplicative inverse step. For example, the inverse of 95 is 8A.  I don't know how to get this result. How is the multiplicative inverse computed?
17066
I know how to do multiplication over ${\rm GF}(2^8)$:  uint8_t  gmul(uint8_t  a, uint8_t  b) {     uint8_t p=0;     uint8_t carry;     int i;     for(i=0;i&lt;8;i++)     {         if(b &amp; 1)             p ^=a;         carry = a &amp; 0x80;         a = a&lt;&lt;1;         if(carry)             a^=0x1b;         b = b&gt;&gt;1;     }     return p; }   So, I tried to create a ${\rm GF}(2^8)$ multiplication table using this code. I've given below the values in the 3rd row of the table, but I don't think they're correct:      0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F 0 1 2   0  2  4  6  8  A  C  E  10 12 14 16 18 1A 1C 1E  3 . . E F   I don't know what went wrong. I built the table by multiplying the values in the first row with those in the first column.  E.g. in the third row, I multiplied 2 &times; 0, 2 &times; 1, &hellip;, 2 &times; E, 2 &times; F.  How can I create a multiplication table for arithmetic in ${\rm GF}(2^8)$?    Also, how can I find the multiplicative inverse of a number in ${\rm GF}(2^8)$?  For example, how can I determine that the inverse of 95 is 8A?  I tried to do this using the multiplication table above, but when I took 9th row and the 5th column in the multiplication table I got 2D, not 8A.
96262
Could you help me fill in a gap in my understanding of maths?  As long as the exponent is rational, I can decompose it into something that always works with primitives I know.  Say, I see a power: $x^{-{a\over b}}$ for natural a,b.   Using the basic rules:   $$\begin {align} x^{-a} =&amp; {1 \over x^a} \\ x^{1\over b} =&amp; \sqrt[b]{x} \\ ({x^a})^b =&amp; {x^{a b}} \end{align}$$  I can always decompose rational exponents into $ x^{{1\over b} \cdot -a} = \sqrt[b]{x} ^ {-a} = {1 \over \sqrt[b]{x}^a }$- and integer degree roots are something well within my grasp. Integer root is always just simply a number of multiplications, $\sqrt[a]{x}$ is just some $y \cdot y \cdot y \cdot ... \cdot y$, as many $y$'s as $a$ says.   If the exponent is irrational, it's trickier, but I can always take $e^{\pi} \approx e^{314159265358979323 \over 100000000000000000}$ and take more $\pi$ digits if needed, and even though the number of underlying multiplications becomes ridiculous, that's still something I can understand.  But I'm completely at loss how to understand stuff like $x^{i\pi \over 4}$. I just can't perform an imaginary number of multiplications. I know how to perform conversion of complex numbers between the exponential and $a+ib$ form, but I perform it like a mysterious voodoo magic recipe without ability to wrap my mind around how that kind of exponentiation is supposed to work. I can still apply the old conversion formulas, $x^a \cdot x^b = x^{a+b}$; $({x^a})^b = {x^{a b}};$ and obtain correct results but I just don't understand the underlying mechanism - as $x^n$ is just $n$ multiplications of $x$, how can understand how that works when $n$ is imaginary?
28025
$8^(a - b)$ produces only a superscripted (; the rest of the power is not superscripted.  How can I superscript the whole (a-b) portion?
79879
I would like to factorise $496241$. I know the answer is $677 \times 733$. But I don't know how to get there.   Here is the full question:   "A message has been encoded using RSA with a modulus of $m = p q = 496241$ (with $p$ and $q$ being primes) and encoding exponent of $218821$.  You are advised that $\{13631, 142703\}$ is a valid encoding–decoding pair for the same modulus, $m$.  (a) Use this information to determine $\phi(m)$ for this modulus. (Using software to directly factorise $m$ is not a valid option for doing this part.)  (b) Verify your answer by determining the primes $p$ and $q$. Show how these combine to give both $m$ and $\phi(m)$."  I need it so I can solve (a), and it says I cannot use software to directly factorise m. So I guess pen and paper. But there are not tutorial online. Thanks
21258
Prove that the multiplicative inverse of $a$ modulo $m$ exists if and only if $a$ and $m$ are coprime.  Can someone help me with this?
10733
A few years ago I devised a symmetric-key system that worked like so:  H()   = some hashing function h     = the number of bits in the result of H() key   = bits to be used as a key ^     = the XOR operation +     = concatenation len() = the length function (in bits)  max = ceiling(len(cipertext) / h) pad = pad_0 + ... + pad_max pad_0 = H(key) ^ H(plaintext) pad_n = H(pad_(n-1)) cipherpart_n = plaintext_n ^ pad_n ciphertext = H(plaintext) + cipherpart_0  + ... cipherpart_max   Basically, it builds up a "pad" based on the hash of the message and hash of the key and XORs the message against it.  I am not actually an expert, so I was wondering why an approach like this isn't very common.
80032
Why must $\mathbb{Q}[\sqrt{2}, \sqrt{3}]$ -- the set of all polynomials in $\sqrt{2}$ and $\sqrt{3}$ with rational coefficients  -- contain multiplicative inverses?   I have gathered that every element of $\mathbb{Q}[\sqrt{2}, \sqrt{3}]$ takes form $a + b\sqrt{2} + c\sqrt{3} + d\sqrt{2}\sqrt{3}$ for some $a,b,c,d \in \mathbb{Q}$, and I have shown that $\mathbb{Q}[\sqrt{2}]$ and $\mathbb{Q}[\sqrt{3}]$ are both fields, but it's not clear to me why this allows for general multiplicative inverses to exist in $\mathbb{Q}[\sqrt{2}, \sqrt{3}]$.
109905
I'm new to security stuff and I have some questions about the keys of transposition cryptography.  If I'm given the encoding key to a transposition cipher, how do I get the decoding key for it? I tried googling but couldn't find any steps on the calculation for it. For example, on several crypto-related websites there are these nifty tools where, when I enter 4 3 1 6 2 5 I would get 3 5 2 1 6 4… but why and how?
90632
I'm interested in algorithms to quickly compute the inverse factorial. I've noted that large factorials have a unique number of digits. How can I use this fact to quickly compute the factorial? Is there a formula,  n = f(n!) = #digits( (n!) )?  I'm mostly interested in the case where we know our input is correct. But, error checking for values that are not factorials would be a bonus. (Perhaps, someone has thought of a way to do the inverse gamma function quickly?)  I'm interested in inputs that have over a million digits, so simply dividing 1,2,3,...,n will not work.
45047
I understand what's going on in higher level. But i don't understand what's really going on in page 3 and 4 of  slide.   Specifically,   How S0 and S1 is used? What goes in what goes out? How exactly  key bits determine which s-box is to be used at each position? Position refers to what? is the function "f" in page 4 exactly the same SP network in page 3?  why split plain text into left L and right R? why XOR L with R after applying "f"?  why rotate after  applying last "f"? why XOR is used? why not some other bitwise operation?    slides for reference
98367
We all know that multiplication is the inverse of division, and therefore $x\div{x}\cdot{x}=x$ But what if $x=0$? $0\div0$ is undefined so $0\div0\cdot0$ should be too, but whatever happens when we divide that first $0$ by $0$ should be reversed when we multiply it by $0$ again, so what is the right answer? 0, undefined, or something else entirely?
107323
So I recently discovered the --s2k mode in gpg.  Sadly it is not very well-documented. I mean, what is s2k even supposed to mean?  Could someone explain to me the purpose and detailed function of s2k?    Is --s2k-cipher-algo even necessary in a symmetric encryption scenario where you define the cipher separately?  What exactly  does --s2k-count do?  What does the number after --s2k-count do? What does it indicate and why is 65 million the highest number? 65 million of what? What is done so many times?
2998
I would like to encode some data with a key, and send it to a third party. They don't know the key to decode it, but I would like to make it possible for them to apply some modifications on it. Then they send i back, I can get decode it, and get the result. For example let the encoded data is the integer 5. I encode it with a key k and it becomes xxxxxx. The user can apply operations to xxxxxx without knowing k, like +5 and *2. After those operaions, the encoded value becomes yyyyyy. If I decode the value with the key k, it should be 20, as if I applied +5 and *2 on the original data 5. Are there any cryptographic algorithms like that?
91089
I remember reading a while back about arithmetics with only a single operator that did all the work of the familiar $+ - \times /$ operators. If there is such a thing, could someone point me to it?  As background: I have a side project where I'm playing with neural nets and genetic search algorithms. Right now it's the good old kind, with matrix multiplication and addition. I thought it would be interesting to implement a sort of neural network that used a combined or "all in one" operator.  I've googled like heck and can't pick up the trail of where I thought I saw that before.  Is there study in that area, or am I mis-remembering, or worse, just making it up? I'd appreciate any pointers.
26520
I am not looking for an answer on this. Just need to clarify why my approach is failing -  $N_1 + N_2 + N_3$, i.e. single digit, double digit, 3 digit  single $= 2, 4, 6, 8$, i.e 4   double = X non-zero $= 8 \cdot 4 = 32$ X zero $= 9 \cdot 1 = 9$  Now the confusing part three digit, breaking into 4 cases   X zero zero $= 9$   X nz nz $= 7 \cdot 8 \cdot 4 = 224$   X z nz $= 8 \cdot 1 \cdot 4 = 32$   X nz z $= 8 \cdot 9 \cdot 1 = 72$  Three digit total comes to $= 9 + 224 + 32 + 72 = 337$. This answer is wrong and it should be $328$. What am I missing in the logic? Please suggest.
26708
I'm currently learning how to find the inverse of a modulo with the Extended Euclid Algorithm and I stumbled upon a problem when finding an inverse when the $m&gt;p$ as for $m \equiv 1 \pmod{p}$  For example, in $$ 240x \equiv 1 \pmod{17} $$ what is the inverse? What are the steps to find it?
104204
If we encrypt a message twice with symmetric key $k_1$ first and then $k_2$ like $E_{k2}\{E_{k1}\{m\}\}$ , ideally we should decrypt with $k_2$ first and then $k_1$ but is it possible to decrypt with $k_1$ and then with $k_2$ ?  Using any of the AES Modes preferably ?