Questions tagged [bignum]

Common computer-jargon term to refer to arbitrary-precision math and data-types. The term "arbitrary-precision" refers to the ability of a machine to perform numerical computations whose precision is limited only by the available memory.

362 questions
0
votes
2 answers

Get the congruence of big numbers javascript RSA algorithm

In the RSA asymmetric cryptography algorithm every user has a public key (n,e) and a private key (d) to send and receive encrypted messages from other users. To encrypt a message it changes the characters to their ascii codes: HELLO ->…
the-breaker
  • 195
  • 1
  • 13
0
votes
0 answers

OpenSSL BN_sub() can't do signed subtraction

I'm trying to perform subtraction using OpenSSL's BN functions. I am expecting a signed integer as the difference, but instead I get either the unsigned integer, or the integer overflows (or if neither I get the desired result). Am I using the…
Colby
  • 313
  • 4
  • 13
0
votes
1 answer

How can I assign a variable the largest 32 bit signed value in ruby without explicitly defining it

I want to be able to assign a variable the number 2147483647, the maximum 32-bit signed integer value. Is there some way that I can retrieve a value from the class, such as Integer::MAX?
agita
  • 29
  • 5
0
votes
1 answer

How to convert an array of int to an OpenSSL BIGNUM?

In C++, I am trying to convert an array of int representing a big integer to a BIGNUM using the OpenSSL library. It's OK with an string containing the hexadecimal encoding of the big number, but I can't find how to do it with an array. #include…
LeMoussel
  • 5,290
  • 12
  • 69
  • 122
0
votes
1 answer

Large number division is too slow using bignumber.js in node.js

I am using this library https://www.npmjs.com/package/big-number to perform division of two large numbers: My function has the following code: var x = new BigNumber(val); var y = new BigNumber(100000000); return x.dividedBy(y).toNumber(); This code…
kosta
  • 4,302
  • 10
  • 50
  • 104
0
votes
0 answers

Calculating s in ECDSA over GF(2m)

I tried to calculate s over GF(m) as integer, but it is not working since the integer in vhdl has limit size, especially since you're working with 2^163.
0
votes
1 answer

decrypting RSA using c^d mod n

I'm trying to get a message out of an RSA code, but cant seem to understand how. The formula i'm trying to use to find the message is: c^d mod n. In the text file i received (which is the RSA code), i have 3 parameters: The c…
afterm3
  • 69
  • 1
  • 5
0
votes
2 answers

LibCrypt what is the use of the `ctx` parameter on BN_div?

In my attempt to implement the Burmester-Desmedt key agreement using pure C I need to divide 2 public keys thus I thought the BN_div should do the job. int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, const BIGNUM *d,BN_CTX *ctx); But when I…
Dimitrios Desyllas
  • 9,082
  • 15
  • 74
  • 164
0
votes
1 answer

Big numbers multiplication algorithm doesn't always work

I'm trying to create a function that reads two positive natural numbers from an input file and, once calculated, writes their product in an output file. The numbers are "big numbers", they can not be stored in a variable such as int or long so I…
Concy
  • 23
  • 4
0
votes
1 answer

Groovy throws Numberformatexception when dealing with extremely large numbers

So using groovy in Intellij IDEA, I get an exception using the following code: def t = (100000G**100000000000G) Now I'm aware these are numbers that no sane human being would ever want to compute, but for the purpose of asking and due to my…
Folling
  • 415
  • 3
  • 12
0
votes
1 answer

How to write a generic function template for openssl bignum?

I m looking to create a simple general function template for the openssl bignum library. I want it to have all the biolerplate includes and other stuff already present and it should follow the same pattern as the other bignum functions. It should…
user73466
  • 141
  • 2
0
votes
1 answer

The result of BN_hex2bn and BN_bn2hex dosen't match?

I use openssl in my C++ project, but a problem make me confused. RSA *rsa = RSA_generate_key(kBits, kExp, 0, 0); cout << "rsa->n: " << endl << rsa->n << endl << "rsa->d: " << endl << rsa->d << endl << "rsa->e: " <<…
Nash
  • 43
  • 9
0
votes
1 answer

Error while installing rspec gem bignum too big to convert into `long'

I was recently trying to change the version of rspec I installed from -v 2.5.0 to 1.3.0 to work with rails 2.x. After uninstalling cucumber, rspec-rails, and rspec I went to reinstall and then recieved the error "ERROR: While executing gem ...…
0
votes
2 answers

Ada - Long (Grade-School) Multiplication of BigNum Integers

I am trying to implement the Grade-School Multiplication algorithm in Ada, and am currently getting an index out of bounds error. I'd appreciate any input on how to fix the error, and successfully implement the Algorithm. Thanks in advance! I have…
Justiciar
  • 356
  • 1
  • 3
  • 20
0
votes
3 answers

handle snippet code wrtten in C for large numbers

I wrote this snippet code as a solution for a problem but in a test case that tries big numbers as input(for example 10000000000 10000000000 1), a weird output comes out.it's work for integer range number but how can I handle code for big numbers?…