Ask Your Question

Hassan Mostafa's profile - activity

2022-12-17 00:11:54 +0100 received badge  Notable Question (source)
2022-07-21 11:25:51 +0100 received badge  Notable Question (source)
2022-07-21 11:25:51 +0100 received badge  Popular Question (source)
2021-09-20 02:59:36 +0100 received badge  Popular Question (source)
2021-03-09 11:20:29 +0100 received badge  Popular Question (source)
2021-03-09 11:20:29 +0100 received badge  Notable Question (source)
2021-03-04 11:01:13 +0100 received badge  Popular Question (source)
2021-03-02 17:05:04 +0100 received badge  Notable Question (source)
2021-03-02 17:05:04 +0100 received badge  Popular Question (source)
2020-05-29 15:58:38 +0100 asked a question binary value of an irreducible polynomial

if i defined the following finite field


then i've generated it's irreducible polynomial

sage: IP=F.polynomial()
sage: IP
x^15 + x^5 + x^4 + x^2 + 1

how can i get the binary representation of this polynomial ?

2020-05-17 00:14:36 +0100 asked a question Elliptic curve over 16-bit binary field

how can i generate and use elliptic curve over 16-bit binary field.

2020-05-07 00:11:47 +0100 asked a question Displaying Z-coordinate of the Elliptic curve points

when i generate an elliptic curve and work with it's points. it is always displaying with Z-coordinate =1 as following:

sage: EC=EllipticCurve(GF(101),[2,3])
sage: EC
Elliptic Curve defined by y^2 = x^3 + 2*x + 3 over Finite Field of size 101
sage: EC.random_point()
(60 : 65 : 1)
sage: point1=EC.random_point()
sage: point1
(3 : 6 : 1)
sage: point2=2*point1
sage: point2
(30 : 55 : 1)

as shown Z-coordinate always = 1. can i work with points with it's normal (original) Z- component ??

2020-04-28 20:17:53 +0100 asked a question I need to represent the Elliptic curve point in projective coordinate with Z coordinate has value not normalized 1

the points over elliptic curve defined over finite field always displayed in projective coordinates (X:Y:Z) with normalised Z component ( always Z = 1). i need points to be in normal projective coordinates ( Z component not always 1 )

2020-04-28 19:58:59 +0100 received badge  Scholar (source)
2020-04-27 10:54:02 +0100 commented answer how can i convert the elliptic curve point representation

it is worked fine. can i generate points directly with integer representation >> make E.random_point() generate random points in integer representation

2020-04-27 02:12:02 +0100 asked a question how can i convert the elliptic curve point representation

i've created an Elliptic curve over finite field GF(2^101). when i generate a random point on this curve is appear as the following representation. p1=(z101^99 + z101^98 + z101^97 + z101^96 + z101^95 + z101^94 + z101^92 + z101^91 + z101^90 + z101^89 + z101^87 + z101^86 + z101^84 + z101^80 + z101^79 + z101^77 + z101^74 + z101^73 + z101^72 + z101^70 + z101^66 + z101^65 + z101^63 + z101^61 + z101^59 + z101^57 + z101^56 + z101^55 + z101^52 + z101^51 + z101^49 + z101^47 + z101^41 + z101^40 + z101^38 + z101^36 + z101^30 + z101^29 + z101^28 + z101^27 + z101^25 + z101^23 + z101^20 + z101^18 + z101^15 + z101^14 + z101^10 + z101^3 + z101^2 + z101 + 1 : z101^100 + z101^99 + z101^96 + z101^90 + z101^88 + z101^87 + z101^85 + z101^82 + z101^81 + z101^72 + z101^70 + z101^69 + z101^68 + z101^67 + z101^66 + z101^62 + z101^60 + z101^59 + z101^58 + z101^53 + z101^52 + z101^50 + z101^49 + z101^48 + z101^46 + z101^45 + z101^44 + z101^43 + z101^42 + z101^40 + z101^39 + z101^37 + z101^36 + z101^34 + z101^32 + z101^27 + z101^26 + z101^25 + z101^23 + z101^15 + z101^13 + z101^12 + z101^9 + z101^7 + z101^3 : 1).

i need this point coordinates to be numbers not polynomials. any recommendations?

2019-12-24 02:40:05 +0100 commented answer Sagemath 8.9 installation problem on ubuntu 18.04

when i did so it has been crashed and generated a report that i have sent to

it is working fine when i use

sudo ./sage

any recommendations ?

2019-12-23 17:56:53 +0100 asked a question Sagemath 8.9 installation problem on ubuntu 18.04

i am trying to install Sagemath 8.9 on ubuntu 18.04.3 LTS. i am doing the following :

  1. downloaded the sage-8.9-Ubuntu_18.04-x86_64.tar.bz2 .

  2. extracted it (with no sudo permission) using

tar xvf sage-8.9-Ubuntu_18.04-x86_64.tar.bz2

  1. cd into the extracted directory named Sagemath and run


as mentioned in the readme file .. it takes long time then gve me the following error:

[dochtml] OSError: [Errno 13] Permission denied: '/home/hassan/.sage/cache/tmpwpNzXa' Makefile:2038: recipe for target 'doc-html' failed make[3]: * [doc-html] Error 1 make[3]: Leaving directory '/home/hassan/SageMath/build/make' Makefile:1849: recipe for target 'all-start' failed make[2]: * [all-start] Error 2 make[2]: Leaving directory '/home/hassan/SageMath/build/make'

real 1m8.422s user 0m40.632s sys 0m3.585s

Error building Sage.

The following package(s) may have failed to build (not necessarily during this run of 'make all-start'):

The build directory may contain configuration files and other potentially helpful information. WARNING: if you now run 'make' again, the build directory will, by default, be deleted. Set the environment variable SAGE_KEEP_BUILT_SPKGS to 'yes' to prevent this.

Makefile:31: recipe for target 'all-start' failed make[1]: * [all-start] Error 1 make[1]: Leaving directory '/home/hassan/SageMath' Makefile:13: recipe for target 'all' failed make: * [all] Error 2

2019-10-15 11:13:47 +0100 commented question inverse binary string bit by bit

no it is not a homework. it is related to sage as for example i am working with cryptography >> Rijndael-GF block cipher which sometimes i need to use binary key, message and ciphers. anyway i've found a function that do this role as following; # toggleBit() returns an integer with the bit at 'offset' inverted, 0 -> 1 and 1 -> 0.

def toggleBit(int_type, offset): mask = 1 << offset return(int_type ^ mask)

2019-10-13 10:54:04 +0100 asked a question inverse binary string bit by bit

if i have a binary string for example x='0110101' and i need to inverse it's bits bit by bit. for example : inverse 1st bit >> x='1110101' inverse 2nd bit >> x='0010101' 3rd bit >> x='0100101'

and so on. how can i do that.

2019-10-07 10:51:28 +0100 asked a question Sagemath 8.8 crash on startup on windows 10

i've just installed sagemath 8.8 on windows 10 with trendmicro office scan installed. after installation and when double click on SageMath icon it is launched and then crash and closed without any error messages. i've tried to add SageMath paths to be excluded from antivirus and doesn't work also ..

2019-10-03 11:21:32 +0100 asked a question Can I control number of rounds of Rijndael-GF class

for Rijndael-GF class which is implementation of AES cipher we define block size and key size but can't control number of round. is there any way to modify number of rounds. for example AES with 4 rounds or 6 rounds ?

2019-07-21 11:11:29 +0100 commented answer elliptic curve point multiplicative inverse

sorry if the question is not clear. i will explain based on your example. given the point P. if i perform scalar multiplication 3*P that will give a new point say P2. my request is to how to calculate P from P2 .. can i make inverse scalar multiplication of P2 by 3 to get the original point P .

2019-07-16 12:06:46 +0100 asked a question elliptic curve point multiplicative inverse

is that possible to calculate the multiplicative inverse for an elliptic curve point . for example X is a point i need to calculate inverse of X such that X*X^-1 give me unity.

2019-07-08 11:35:07 +0100 received badge  Student (source)
2019-07-08 10:12:37 +0100 asked a question overflowerror: range() result has too many items

i am working with elliptic cure NIST p-521. i am trying to do loop with the syntax " for i in range (n): ". but n is too large for ex: n= 6864797660130609714981900799081393217269435300143305409394463459185543183397653210140554620662074004704518954203785444253993810126864972419532086575239231303.

which give the error

overflowerror: range() result has too many items .

2019-07-06 22:11:41 +0100 commented answer how can i export an elliptic curve over finite field values as a look up table.

i've followed these steps but there is an issue. as i work on NIST-P521 curve so it's order is very large number so i am receiving the following error

OverflowError:range() result too many items

is there a way to solve this

2019-07-02 14:14:18 +0100 asked a question how can i export an elliptic curve over finite field values as a look up table.

i need to export an elliptic curve over finite field after it's generated as a lookup table.. like two columns ( finite field element, it's output point after multiplied by the generator point of the curve). how can i do this?