Integers in hashes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Integers in hashes

Malte Zacharias
Hello folks,

I have a question concerning the use of Integers in hashing methods,
I am currently trying to implement a management application
for my LDAP tree at home in Smalltalk using Seaside. Actually Seaside
view is yet to come as it is the model and business logic I'm working on right
now and which is giving me serious problems. For administration of
my Samba User Accounts, I need to be able to create a password hash suitable
for NT and LM, thanks to the author of another piece of software which is able
to do exactly that, I am in possession of a suitable code piece.
Unfortunately that code-piece was written in PHP and gives me some problems,
it makes use of bit shifting operations.
As I am trying to translate the algorithm to Smalltalk I get into problems as
PHP integers are of fixed size, if I shift left, I just lose bits, which is
what is intended. If I'd do the same in Smalltalk, my Integers just keep on
getting larger, just as they're supposed to do.

My question basically is, how can I avoid this? How could I translate that
hashing algorith to Smalltalk without putting much work in it? It is not
object oriented, but in this single case I do not care about it, I would be
happy with a quick and dirty solution, in a dedicated class that I could
still optimize (I know that would mean rewriting in this case ;-) ) later on.

So what should I do?

Best regards,
Malte Zacharias

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Integers in hashes

Travis Griggs

On Aug 16, 2006, at 15:09, Malte Zacharias wrote:

Hello folks,

I have a question concerning the use of Integers in hashing methods,
I am currently trying to implement a management application
for my LDAP tree at home in Smalltalk using Seaside. Actually Seaside
view is yet to come as it is the model and business logic I'm working on right 
now and which is giving me serious problems. For administration of
my Samba User Accounts, I need to be able to create a password hash suitable
for NT and LM, thanks to the author of another piece of software which is able 
to do exactly that, I am in possession of a suitable code piece. 
Unfortunately that code-piece was written in PHP and gives me some problems,
it makes use of bit shifting operations.
As I am trying to translate the algorithm to Smalltalk I get into problems as 
PHP integers are of fixed size, if I shift left, I just lose bits, which is 
what is intended. If I'd do the same in Smalltalk, my Integers just keep on 
getting larger, just as they're supposed to do.

My question basically is, how can I avoid this? How could I translate that 
hashing algorith to Smalltalk without putting much work in it? It is not 
object oriented, but in this single case I do not care about it, I would be 
happy with a quick and dirty solution, in a dedicated class that I could 
still optimize (I know that would mean rewriting in this case ;-) ) later on.

So what should I do?

Follow each shift operation with a bitAnd: 16rFFFFFFFF.

Or...

Use Martin's ThirtyBitRegistry from the SecurityBase package. It even has the << bit shift methods.

As an aside, interesting trickery used to keep said object going fast.

--
Travis Griggs
Objologist
"You A students, you'll be back soon teaching here with me. You B students, you'll actually go on to be real engineers. You C students, you'll go into management and tell the A and B students what to do." - My Fluid Dynamics Professor whom I have yet to disprove



DISCLAIMER: This email is bound by the terms and conditions described at http://www.key.net/disclaimer.htm

Reply | Threaded
Open this post in threaded view
|

RE: Integers in hashes

Boris Popov, DeepCove Labs (SNN)
In reply to this post by Malte Zacharias
I imagine there is already an implementation in VisualWorks as its HTTP
client supports NTLM authentication scheme. Load NetClients and look for
implementors of #lmResponseFrom: and NTLMAuthentication class more
generally.

Hope this helps,

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-----Original Message-----
From: Malte Zacharias [mailto:[hidden email]]
Sent: Wednesday, August 16, 2006 3:10 PM
To: VWNC
Subject: Integers in hashes

Hello folks,

I have a question concerning the use of Integers in hashing methods,
I am currently trying to implement a management application
for my LDAP tree at home in Smalltalk using Seaside. Actually Seaside
view is yet to come as it is the model and business logic I'm working on
right
now and which is giving me serious problems. For administration of
my Samba User Accounts, I need to be able to create a password hash suitable
for NT and LM, thanks to the author of another piece of software which is
able
to do exactly that, I am in possession of a suitable code piece.
Unfortunately that code-piece was written in PHP and gives me some problems,
it makes use of bit shifting operations.
As I am trying to translate the algorithm to Smalltalk I get into problems
as
PHP integers are of fixed size, if I shift left, I just lose bits, which is
what is intended. If I'd do the same in Smalltalk, my Integers just keep on
getting larger, just as they're supposed to do.

My question basically is, how can I avoid this? How could I translate that
hashing algorith to Smalltalk without putting much work in it? It is not
object oriented, but in this single case I do not care about it, I would be
happy with a quick and dirty solution, in a dedicated class that I could
still optimize (I know that would mean rewriting in this case ;-) ) later
on.

So what should I do?

Best regards,
Malte Zacharias

smime.p7s (4K) Download Attachment