Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 258227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:09:47+00:00 2026-05-11T22:09:47+00:00

I am looking for a way to uniformly choose values in GF(2^M) between two

  • 0

I am looking for a way to uniformly choose values in GF(2^M) between two bounds.

GF(2^M) is a Galois Field – See GF(4) as defined on this page – http://www.math.umbc.edu/~campbell/Math413Spr09/Notes/12-13_Finite_Fields.html
From a technical, non-math perspective, this is most similar to CRC operations.

For example:

ulong gf2step( ulong x, int bits, ulong p ) 
{  
    x = x << 1;   // "multiply" by x 
    if ( x >= (1 << bits)) x = x ^ p;   
    return x;
}  

Expanding the example from below:

  12 is '1100  
 '1100 shifted left by 1 becomes `11000. Since bit 4 is set, xor with `10011 (p). 
  Next is `1011 or 11. 

Similarly,

  9 is '1001
 '1001 shifted left by 1 becomes `10010. Since bit 4 is set, xor with `10011 (p). 
  Next is `0001.

My obvious method is to start with the integer exponents corresponding to the bounds, pick a random exponent between those and generate the value from that.

However, this has two problems —
1. Given arbitrary bounds, I can’t find the corresponding integer exponent..
2. This will be repeated many, many times, so I am concerned about exponentiation speed.

Example:

 int gf2random( ulong low, ulong high, ulong p); 

 gf2random( 12, 13, 19) should return evenly from the set {12, 11,5,10,7,14,15, 13}
 gf2random( 9, 1, 19)  should return either 9 or 1 

I can step the values in GF(2^M) fairly easily – but I’m not sure how to avoid overshooting the upper bound.


Does it simplify the problem if the low bound was always ‘1’ ?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:09:47+00:00Added an answer on May 11, 2026 at 10:09 pm

    I’m not completely sure I understand your question, so I’ll try to reformulate it.
    You are given a finite field GF(2^M) a generator g of the multiplicative group and two elements g^a and g^b. You may or may not know the exponents a and b. The question is to uniformly select elements g^c where a<= c < b. Since you say that tables are not an option I’d assume you want to work with a rather large M. Hope I got this right.

    If M is large then discrete logarithm is hard to compute. Hence if you don’t know a and b upfront you’ll not be able to find them. The difficulty of the discrete logarithm also implies that given a random element h in GF(2^M) it is hard to decide whether h is one of the valid elements g^c, because if you had such an algorithm to make this kind of decision then this algorithm could be used to solve discrete logarithms. In particular if you have two elements g^a and g^c and don’t know either a or c then you can’t easily decide whether c < a or not.

    From the comments above I’d expect that your problem is not easily solvable, even though what I wrote is not a proof. It might be helpful, if you also added a bigger picture of the problem that you want to solve. Maybe there is some other way to generate the random elements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

looking a way to make a toggle on doubleclick, this is my code: $('#mydiv').toggle(function()
I'm looking for way to PHP to detect if a script was run from
I am using the jquery-ui-dialog plugin I am looking for way to refresh the
I looking for a way, specifically in PHP that I will be guaranteed to
I looking for a way to programmatically start a VOIP call using the SIP
I'm looking for some way to effectively hide inherited members. I have a library
I'm looking for any way that I can improve the selector performance of a
I'm looking for a way to poll different servers and check that SQL server
I'm looking for a way to delete a file which is locked by another
I'm looking for a way to visually mark or tag a window (any OS)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.