Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 143
Registered: ‎07-14-2008
My Device: Not Specified

Re: Converting a package String (like com.rim.sample) to long without the JDE

What would be nice is if RIM would just tell everyone, so we don't have to guess, and can avoid potential collisions.

 

RIM, the standard SHA-1 is 160 bits (20 bytes), how is it that your hash is 64 bits (8 bytes)???  What algorithm are you using so that it may be duplicated?

 

Patrick

 

Developer
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Converting a package String (like com.rim.sample) to long without the JDE

echo -n matches the examples,

 

$ echo -n "net.rim.sample.AddressBook" | gpg --print-md sha1
299A F578 9315 B3A3 FE12  FB18 FA28 E1E4 717F D439


$ echo -n "net.berrysoft.dib.Game" | gpg --print-md sha1
3BAA 19CE F8E6 D0E4 2464  196F 05DA D75C 426E 3851
  0xe4 d0 e6 f8 ce 19 aa 3bL

And I was just watching a show on backward hidden messages in Led Zeppelin songs,

time is reversible the music isn't or something like that.

 

Developer
Posts: 143
Registered: ‎07-14-2008
My Device: Not Specified

Re: Converting a package String (like com.rim.sample) to long without the JDE

That is too funny.  Excellent find!  Was funny because I too was looking "backwards" and thinking about Led Zeplin.  =)  When you looked at the cover of LZ IV, there is a big clue..... a man has wood on his back..... back woods..... backwards.  =)

 

Patrick

 

Developer
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Converting a package String (like com.rim.sample) to long without the JDE

So did the "-n" get kudoed or the zeppelin thing?

 

Developer
Posts: 143
Registered: ‎07-14-2008
My Device: Not Specified

Re: Converting a package String (like com.rim.sample) to long without the JDE

.htob tub nileppez deL yltsoM

 

Developer
Posts: 143
Registered: ‎07-14-2008
My Device: Not Specified

Re: Converting a package String (like com.rim.sample) to long without the JDE

Here is a bash script that accomplishes the deed:

 

 

#! /bin/bash # SHA1 # # Created by P.T. Waugh MA, based on an idea from members of # the Blackberry support forums. # License: GPLv2, may be freely distributed and modified as deisred. if [ $# -eq 0 ] then echo "Usage: sha1 [-bb] string" 1>&2 exit 1 fi if [ $# = 1 ] then str="${1}" else str="${2}" fi function reverse { # Echo last byte first echo -n ${1#??} echo -n ${1%??} } echo -n "${str}: " digest=$(echo -n $str | gpg --print-md sha1) if [ ! "${1}" = "-bb" ] then echo ${digest} else # Show Blackberry sha1 echo -n "0x" set -- $digest reverse $4 reverse $3 reverse $2 reverse $1 echo "L" fi exit 0

 

Now if only we had a signature server for our private signatures that would run on Linux.  =)