1

I'm working with one-way accumulators, but I'm not knowledgable in cryptography. Is there an easy peasy way to hash numbers (or whatever) into prime numbers? Obviously I'd like it to be collision resistant and all that, but this project is huge, I'm alone and I'm confident someone else in the field will pick up from there. Also, primality tests are linear in n or what? Thanks

gurghet
  • 179
  • 9

2 Answers2

1

Thank you for your answers but I think I found a better method.

  1. Take the hash of your input $h(x)$, preferably with random oracle approximation
  2. Sample the interval $[2^kh(x), 2^k(h(x)+1)]$ and pick only primes, for each of them
  3. Hash it with an universal hashing function $f$ until you find that $f(p)=h(x)$
  4. Write to memory: $H(x)=p$

Done!


notes:

  1. The random oracle makes collisions infeasible

  2. Universal hashing gives high density of primes with high probability (there is a theorem out there but the principle is that, for a given prime, I have multiple hash outputs, so the probability that one of them is my input increases. See: Gennaro et al. - Secure hash-and-sign signatures without the Random Oracle, lemma 2)

e-sushi
  • 17,891
  • 12
  • 83
  • 229
gurghet
  • 179
  • 9
  • What is $k$? Why the universal hashing function? I don't see how this is "better" than the standard PRNG method CodesInChaos suggested in the comments. – Thomas Apr 16 '14 at 07:46
  • Why $h(x)$? If this works there are only $k$ bits to play with in step 2. Thus only $2^k$ tests in the worst case. – gurghet Apr 16 '14 at 07:52
  • k is just a small int. The random oracle protects me from collisions @Thomas – gurghet Apr 16 '14 at 07:53
  • @gurghet Again, what advantage does this scheme have over using a PRNG? You can't claim it's "better" without giving any explanation, you should elaborate so future people reading this can understand why. – Thomas Apr 16 '14 at 08:24
  • @Thomas I've updated the answer. I just have to find the theorem for the second statement, I'm sure I have seen it somewhere but can't remember where :( – gurghet Apr 16 '14 at 13:19
  • Sounds needlessly complicated. I see no advantage over the straight forward approach. – CodesInChaos Apr 16 '14 at 14:06
  • @CodesInChaos, there is no immediate advantage, in fact I'm using your solution now for testing purposes. Sooner or later though, this thing will go in production, and a key space of 32 bit will not be sufficiently large! (for starters) – gurghet Apr 16 '14 at 14:29
  • @gurghet With a PRNG I mean a cryptographically secure stream cipher which obviously has keys of at least 128 bits. So I don't know where your 32 bit key space comes from. – CodesInChaos Apr 16 '14 at 14:41
  • 2
    You state without reference "Universal hashing gives high density of primes with high probability". I fail to see why, and doubt it. And I fail to see why it would matter, for the input of the universal hash is prime in your method, not the output. -- Trying $p$ until $f(p)=h(x)$ is expected to require $2^{w-1}$ steps where $w$ is the output width of $h$, and thus impractical. -- The method outlined by CodesInChaos seems just fine to me. – fgrieu Apr 16 '14 at 14:48
  • Well, if the density is high, say it's 0.01, I only need 100 samples, this is why it's important. @fgrieu as soon as I find the theorem, I will publish the reference to it. – gurghet Apr 16 '14 at 15:31
  • @gurghet Just a small heads-up: don’t forget to accept your own answer if it satisfies your needs. ;) – e-sushi May 15 '14 at 23:11
-1

Misiec´s conjecture:

Let

$$x= \frac{1}{n \cdot n^{\frac{1}{2} + n \cdot 2 \cdot i}}$$

if $n$ is a prime number then the $\sin(x)=x$, and if not the number is not a prime number.

Even though the conjecture does not hold true the $x$ value obtained turns a non-prime number into a complex prime number.

Maarten Bodewes
  • 92,551
  • 13
  • 161
  • 313
  • Can I turn this into an algorithm? – gurghet Jan 20 '20 at 13:47
  • 1
    Welcome, Luis. Can you check the algorithm for correctness? MathJax explanation is here. Please also provide a reference to the conjecture, it seems hard to find. – Maarten Bodewes Jan 20 '20 at 16:46
  • 5
    I would definitely like to see a proof of this. It smells like BS. – user253751 Jan 20 '20 at 17:45
  • The equality seems to always hold, thus the conjecture looks false: https://bit.ly/2tr9xJq Zooming on the prime 7, the curves do not join, so I guess the difference between the curves comes from computation errors: https://bit.ly/2G6OnD5 – A. Hersean Jan 20 '20 at 17:53
  • sorry i do not have a proof as it came to me by verifying that the sumation of the zeta function when divided by n when n is a prime all the numbers expressed by the equation f(x) you get a result where the sin of x is equal x, – luis felipe massena misiec Apr 10 '20 at 22:03
  • if you may just use the google search bar and type any number in the form shoen above for x and you get numbers that respect the squeeze theorem for the limit of x going to zero, it just rounds up the numbers, so it is something to consider because as far as i know sinx=x gives x= zero, but the numbers obtained are squeezed between 0 and the given complex number obtained, as if they had only a relation to them selves and 1. For instance 1/4747^(1/2+4747i))=-0.112984719 - 0.0922553474 i and sin(1/4747^(1/2+4747i)))=-0.113224614 - 0.0917972145 – luis felipe massena misiec Apr 10 '20 at 22:03
  • i given an interval of confidence they are equal just rounded up. check for riemanns hypothesis solution update for the graphs you will see that the graph of the sin of the summation of the numbers given by x are exactly the same as the graph for the summation only – luis felipe massena misiec Apr 10 '20 at 22:04
  • I made a mistake in the typing consider 1/2+ 2ni for 1/2+nni – luis felipe massena misiec Apr 10 '20 at 22:26