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

HSS 15PCS VALVE SEAT & FACE CUTTER 45DEC 30DEC 20DEC FOR VINTAGE CAR, BIKES,JEEP
$197.0
HSS 15PCS VALVE SEAT & FACE CUTTER 45DEC 30DEC 20DEC FOR VINTAGE CAR, BIKES,JEEP pictureHSS 12PCS VALVE SEAT & FACE CUTTER 45DEC 30DEC 20DEC FOR VINTAGE CAR, BIKES,JEEP
$165.0
HSS 12PCS VALVE SEAT & FACE CUTTER 45DEC 30DEC 20DEC FOR VINTAGE CAR, BIKES,JEEP pictureVintage PELOUZE Petite POSTAL SCALE Model P-1 Rates Effective Dec 31, 1975
$2.99
Vintage PELOUZE Petite POSTAL SCALE Model P-1 Rates Effective Dec 31, 1975 pictureDEC Vintage Rare Ic Purple Ceramic Cpu 750A 19-19004-00 3249-51 Collectible
$15.99
DEC Vintage Rare Ic  Purple Ceramic Cpu 750A 19-19004-00 3249-51 Collectible pictureDEC / AMI 304E 21-15542-01 vintage ceramic IC *NEW* UIC p/n 40278101
$79.0
DEC / AMI 304E 21-15542-01 vintage ceramic IC *NEW* UIC p/n 40278101  picture






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