BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 10-04-2007, 05:17 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Jul 2007
Model: 8800
PIN: N/A
Carrier: TDC
Posts: 115
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default convert String to long

Please Login to Remove!

I want to convert my pin+some text i have into a long.

I want this to be done at runtime, so the rightclicking wont help me.

Anyway i can do this?
Offline  
Old 10-04-2007, 05:32 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Long.parseLong(String s)

hth,
simon
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 10-04-2007, 07:02 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: Jul 2007
Model: 8800
PIN: N/A
Carrier: TDC
Posts: 115
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

that my friend, will give you an exception...
Offline  
Old 10-04-2007, 07:09 AM   #4 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

it's been a while since i did it but i think i remember that the jde uses the sha1 algorithm to create the long for use in key stores.

simon was thinking you just wanted to convert a long number represented by a string to long.
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 10-04-2007, 07:17 AM   #5 (permalink)
Thumbs Must Hurt
 
Join Date: Jul 2007
Model: 8800
PIN: N/A
Carrier: TDC
Posts: 115
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by jfisher View Post
it's been a while since i did it but i think i remember that the jde uses the sha1 algorithm to create the long for use in key stores.

simon was thinking you just wanted to convert a long number represented by a string to long.
well... i wrote pin+some text

you wouldnt by any chance have a fancy method that did the work would u?
Offline  
Old 10-04-2007, 07:29 AM   #6 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

it was for a module that added the rim jde string to long functionality to netbeans, i used the bouncycastle digest:

SHA1Digest sha1Digest = new SHA1Digest();
sha1Digest.update(String2Convert.getBytes(), 0, String2Convert.length());
byte[] hashValBytes = new byte[sha1Digest.getDigestSize()];
sha1Digest.doFinal(hashValBytes, 0);
long hashValLong = 0;

for( int i = 0; i < 8; i++ ) {
hashValLong |= ((long)(hashValBytes[i]) & 0x0FF)<<(8*i);
}
String hexString = "0x" + Long.toHexString(hashValLong) + "L";
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

RARE Western Digital WD33C93A-PL Proto SCSI IC NEW Leftover for Amiga 3000 Etc
$39.95
RARE Western Digital WD33C93A-PL Proto SCSI IC NEW Leftover for Amiga 3000 Etc pictureSMPTE Output Studio 16 Extras The Complete SMPTE Generator For Your Amiga
$14.99
SMPTE Output Studio 16 Extras The Complete SMPTE Generator For Your Amiga pictureSaronix 33Mhz Crystal Oscillator 33.3000 Mhz Half Can NEW Amiga Apple PC NOS
$2.75
Saronix 33Mhz Crystal Oscillator 33.3000 Mhz Half Can NEW Amiga Apple PC NOS picturePLE 40Mhz Crystal Oscillator 40.000000 Mhz Half Can NEW Amiga Apple PC
$2.75
PLE 40Mhz Crystal Oscillator 40.000000 Mhz Half Can NEW Amiga Apple PC pictureNEW Motorola MC68030RC40B 40Mhz PGA 128 Pin Gold Amiga Apple CPU MMU Processor
$28.95
NEW Motorola MC68030RC40B 40Mhz PGA 128 Pin Gold Amiga Apple CPU MMU Processor picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.