2019-01-22 12:28:18 -0600 asked a question Is it possible to use OAEP in Sagemath Hey guys, I was wondering if there is any padding module/function in Sagemath for OAEP padding. OAEP is used with RSA, but I am trying to check whether I can use it with a different public key cryptosystem. Cheers 2018-12-11 10:36:53 -0600 asked a question F4 and F5 implementation in Sagemath Hi all, Is there an implementation in Sagemath for the F4 and F5 algorithms that relates to Grobner bases? I found something about libsingular:slimgb, however I am not 100% sure if it is the right algorithm. Could you please let me know? Thanks 2018-12-03 05:02:37 -0600 commented question Trying to get the right inverse, not possible @rburing any idea on this? 2018-11-29 12:33:06 -0600 received badge ● Commentator 2018-11-29 12:33:06 -0600 commented question Trying to get the right inverse, not possible Also, just to make it easier: https://github.com/miguelmarco/DME/tr.... The implementation I am trying it taken from the file find m1 and m2 I am following the author's code so should be simillar from my point of view 2018-11-29 12:22:13 -0600 commented question Trying to get the right inverse, not possible Sure, it can be found here: https://www.mat.ucm.es/~iluengo/DME/p.... Also, it has a section Code where you can see the C code. 2018-11-29 10:18:44 -0600 commented question Trying to get the right inverse, not possible I have to add that normally, I would want both M1 and M2 to be invertible, which it is the case when e > 9. Although when e < 9 M1 or M2 are sometimes invertible, they are not both invertible at the same time. Best to try with e = 4 2018-11-29 09:54:30 -0600 asked a question Trying to get the right inverse, not possible Hey guys, I am working on a project and I am trying to find a matrix that is invertible using the following code: e = 5; n = 2; m = 3; s = 2; t = 2; b = 2; mon = (b * n^s)^t mon2 = b * n^s #F_q is F_2/{irreducible element in F_2} F. = GF(2)[]; for p in F.polynomials(e): if p.is_irreducible(): break; K. = GF(2^e, name='q', modulus=p); Zn = Integers(2^(e*n)-1); Zm = Integers(2^(e*m)-1); R = PolynomialRing(K,'X'); R.inject_variables(); M1 = matrix(K,mon,mon); M2 = matrix(K,mon,mon); M1inv = matrix(K,mon,mon); M2inv = matrix(K,mon,mon); pt_sec2pub = matrix(K,mon,m*n); #Constructing matrix A using the variables mentioned in the paper A = matrix(Zn,m,m); while True: for i in range(0,m): for j in range(0,m): if(s = GF(2)[]; for p in F.polynomials(e): if p.is_irreducible(): break; R. = PolynomialRing(GF(2),name="x").quotient(p) I = Ideal([R.random_element(),R.random_element(),R.random_element(),R.random_element(),R.random_element(),R.random_element()]) print I.groebner_basis()  However I get an error: 'Ideal_pid' object has no attribute 'groebner_basis' I am new to Sagemath so sorry if I misunderstand something. Also, how can I possibly make R to become a multivariate system by following the same structure, using an irreducible polynomial from GF(2) as presented in this code. Thanks guys :) 2018-11-06 04:48:34 -0600 asked a question How to convert an Integer to a GF representation Hi, I would like to convert an Integer to a GF, however I do not seem to find anything about this or whether it is possible or not. I am using the following code: e = 48 n = 2 m = 3 F. = GF(2)[] K. = GF(2^48, name='q', modulus=t^48 + t^28 + t^27 + t + 1, repr='int') test = 0x944a58ec1f29 print test print Integer(test) print K(test)  Thank you 2018-11-02 09:56:31 -0600 commented answer How to solve raising a polynomial to the power of a number mod something Thanks for letting me know, solved it :) made my understand that I should look a bit more at my logic. I will mark this as the solution, however, the inverse was not the issue here. 2018-11-02 06:54:08 -0600 commented answer How to solve raising a polynomial to the power of a number mod something It is not this: (x^n)^k that I am afraid of. I want a and b to be of the following form: a*b = 1 mod 2^96-1 such that when i do (x^a)^b, it will give me x. But if I do the lift on b, then it wont maintain the property that it is the inverse of a in mod 2^96-1 2018-11-01 12:35:30 -0600 commented answer How to solve raising a polynomial to the power of a number mod something It doesn't help, I want to be able to keep the exponent modulo such that it reduces when I multiply it with its inverse, as in Diffie Helman 2018-11-01 09:56:09 -0600 commented question How to solve raising a polynomial to the power of a number mod something K is GF(2^48) and x is a vector of K elements 2018-11-01 08:56:30 -0600 commented question How to solve raising a polynomial to the power of a number mod something Edited with the code. Sorry for my code being very messy 2018-11-01 08:55:44 -0600 received badge ● Editor (source) 2018-11-01 08:46:34 -0600 asked a question How to solve raising a polynomial to the power of a number mod something I want to raise the polynomial vec1[0] to the power of a number mod x (vec1[0])^Binv[0][0], however when I do that, I receive the following message: unsupported operand type(s) for &: 'sage.rings.finite_rings.integer_mod.IntegerMod_gmp' and 'int' When I change Binv[0][0] to be an integer, everything works fine, however, this is not what I want to achieve. Is there any workaround to this? Z3 = Integers(2^(e*m)-1); B = matrix(ZZ,2,2); F11 = 50; F12 = 24; F21 = 7; F22 = 88; B[0,0] = 2^F11; B[0,1] = 2^F12; B[1,0] = 2^F21; B[1,1] = 2^F22; #print B[0][0] B_mod = B.mod(2^(e*m)-1) #print B_mod Binv = matrix(Z3,2,2); Binv = B_mod.inverse(); R = PolynomialRing(K,'X'); R.inject_variables(); #Find irreducible polynomial of degree 3 while True: c = K.random_element(); d = K.random_element(); f = K.random_element(); IP3 = X^3 + c*X^2 + d*X + f; if IP3.is_irreducible(): break; RRR = R.quotient(IP3,'Y') RRR.inject_variables() vec1 = X^2 * x[0] + X * x[1] + x[2] result1 = RRR(vec1[0])^Binv[0][0]  2018-10-30 15:49:46 -0600 received badge ● Scholar (source) 2018-10-26 10:39:23 -0600 received badge ● Student (source) 2018-10-26 10:26:17 -0600 asked a question Creating a matrix that has elements part of a GF I am currently doing some implementation but I have something that I do not seem to find online and bugged me for a few hours: e = 48; K = GF(2^e); KE = GF(2^(e*2)); A = matrix(KE,3,3); E11 = 24; E12 = 59; E21 = 21; E23 = 28; E32 = 29; E33 = 65; A[0,0] = 2^E11; A[0,1] = 2^E12; A[0,2] = 0; A[1,0] = 2^E21; A[1,1] = 0; A[1,2] = 2^E23; A[2,0] = 0; A[2,1] = 2^E32; A[2,2] = 2^E33; print A[2][1]  When I do this, it print 0, but given that I created it in GF(2^(e*2)), I believe it shouldn't. Because of this, when I try to get the inverse of this matrix, which is invertible, I do not get anything. Please let me know if you have any thoughts. 2018-10-26 10:26:17 -0600 asked a question Question regarding matrix of GF I am currently doing some implementation but I have something that I do not seem to find online and bugged me for a few hours: e = 48; K = GF(2^e); KE = GF(2^(e*2)); A = matrix(KE,3,3); E11 = 24; E12 = 59; E21 = 21; E23 = 28; E32 = 29; E33 = 65; A[0,0] = 2^E11; A[0,1] = 2^E12; A[0,2] = 0; A[1,0] = 2^E21; A[1,1] = 0; A[1,2] = 2^E23; A[2,0] = 0; A[2,1] = 2^E32; A[2,2] = 2^E33; print A[2][1] When I do this, it print 0, but given that I created it in GF(2^(e*2)), I believe it shouldn't. Because of this, when I try to get the inverse of this matrix, which is invertible from what the author said, I do not get anything. Please let me know if you have any thoughts