Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #18823
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2012-09-18 10:10 -0700 |
| References | <k3a74r$u3s$1@news.m-online.net> |
| Message-ID | <a7e8fd59-4a4a-499e-9366-bedad1d5e097@googlegroups.com> (permalink) |
| Subject | Re: get hexadecimal hash string for a number |
| From | Lew <lewbloch@gmail.com> |
Magnus Warker wrote: > I want users to register on a site and send confirmation emails to them. > These emails should contain a link like this: > > http://myurl?registration=E4AC4BD4 > > Here, "E4AC4BD4" should be a unique string. My idea for such a string is > just to hash an integer, i. e. the internal database key for the > registration record. > > However, I actually don't know how to get such a hash. I tried BCrypt, > but this produces hashes built out of characters that I would not want > to be in a URL, e. g. commatas and that. > > I would like to have a string like this: > > - hexadecimal only > - fixed size, e. g. always n characters, independend of the integer > > Can you help? First of all, hashing a unique integer is silly. It's already unique! If you have a reliably unique, stable integer ID, you don't need to hash it! Just use the value. Got that? Good, because an internal database ID is not reliable. It's *internal*! It's not meant to be used externally! Got that? Good, because the database record has (or you're not doing it right) an external unique key, one based on visible attributes. You could hash that key. Or you could perhaps use http://docs.oracle.com/javase/7/docs/api/java/rmi/server/UID.html You'll want to store that UID with the registration record. First and foremost google around for hash codes and how to use them. Your lack of understanding will screw you otherwise. -- Lew
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
get hexadecimal hash string for a number Magnus Warker <magnux@mailinator.com> - 2012-09-18 18:25 +0200
Re: get hexadecimal hash string for a number markspace <-@.> - 2012-09-18 10:08 -0700
Re: get hexadecimal hash string for a number Lew <lewbloch@gmail.com> - 2012-09-18 10:14 -0700
Re: get hexadecimal hash string for a number Arne Vajhøj <arne@vajhoej.dk> - 2012-09-18 19:58 -0400
Re: get hexadecimal hash string for a number markspace <-@.> - 2012-09-18 17:27 -0700
Re: get hexadecimal hash string for a number Arne Vajhøj <arne@vajhoej.dk> - 2012-09-18 21:17 -0400
Re: get hexadecimal hash string for a number Arne Vajhøj <arne@vajhoej.dk> - 2012-09-18 21:21 -0400
Re: get hexadecimal hash string for a number Magnus Warker <warker@mailinator.com> - 2012-09-19 08:27 +0200
Re: get hexadecimal hash string for a number Arne Vajhøj <arne@vajhoej.dk> - 2012-09-19 18:30 -0400
Re: get hexadecimal hash string for a number Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2012-09-19 19:06 -0700
Re: get hexadecimal hash string for a number Magnus Warker <warker@mailinator.com> - 2012-09-20 11:32 +0200
Re: get hexadecimal hash string for a number Lew <lewbloch@gmail.com> - 2012-09-18 10:10 -0700
Re: get hexadecimal hash string for a number Arne Vajhøj <arne@vajhoej.dk> - 2012-09-18 20:02 -0400
Re: get hexadecimal hash string for a number Magnus Warker <warker@mailinator.com> - 2012-09-19 08:18 +0200
Re: get hexadecimal hash string for a number Roedy Green <see_website@mindprod.com.invalid> - 2012-09-18 10:23 -0700
Re: get hexadecimal hash string for a number Arne Vajhøj <arne@vajhoej.dk> - 2012-09-18 20:00 -0400
Re: get hexadecimal hash string for a number Arne Vajhøj <arne@vajhoej.dk> - 2012-09-18 20:06 -0400
Re: get hexadecimal hash string for a number markspace <-@.> - 2012-09-18 17:30 -0700
Re: get hexadecimal hash string for a number Arne Vajhøj <arne@vajhoej.dk> - 2012-09-18 21:07 -0400
Re: get hexadecimal hash string for a number Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2012-09-18 22:50 -0700
Re: get hexadecimal hash string for a number Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-09-19 01:06 -0500
Re: get hexadecimal hash string for a number rossum <rossum48@coldmail.com> - 2012-09-19 17:34 +0100
Re: get hexadecimal hash string for a number Magnus Warker <warker@mailinator.com> - 2012-09-20 11:30 +0200
Re: get hexadecimal hash string for a number rossum <rossum48@coldmail.com> - 2012-09-21 12:48 +0100
Re: get hexadecimal hash string for a number Lew <lewbloch@gmail.com> - 2012-09-21 10:15 -0700
Re: get hexadecimal hash string for a number Magnus Warker <warker@mailinator.com> - 2012-09-26 06:11 +0200
Re: get hexadecimal hash string for a number Arne Vajhøj <arne@vajhoej.dk> - 2012-09-26 09:29 -0400
Re: get hexadecimal hash string for a number Gene Wirchenko <genew@ocis.net> - 2012-09-26 09:18 -0700
Re: get hexadecimal hash string for a number markspace <-@.> - 2012-09-21 10:56 -0700
Re: get hexadecimal hash string for a number Magnus Warker <warker@mailinator.com> - 2012-09-26 06:12 +0200
Re: get hexadecimal hash string for a number Arne Vajhøj <arne@vajhoej.dk> - 2012-09-23 20:57 -0400
csiph-web