Ruby on Rails Friday, December 2, 2011

I think in earlier versions, I put modules into RAILS_ROOT/lib

I have a module that I extracted from activesambaldap to create a Windows Hash Password that I will need to use on occasion that looks something like this...

require 'openssl'

module Samba
module Encrypt
module_function
def lm_hash(password, encoding=nil)
dos_password = Private.convert_encoding("ISO-8859-1",
encoding || "UTF-8",
password.upcase)
if dos_password.size > 14
warn("password is truncated to 14 characters")
dos_password = dos_password[0, 14]
end
Private.encrypt_14characters(dos_password).unpack("C*").collect do |char|
"%02X" % char
end.join
end
...

Can I just drop it in 'RAILS_ROOT' lib and require it when I need it?

--
Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ craig.white@ttiltd.com
1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com

Need help communicating between generations at work to achieve your desired success? Let us help!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment