From: Stefano Crocco Date: 2012-02-09T06:43:20+09:00 Subject: Re: how crypt works Il giorno Thu, 9 Feb 2012 06:38:18 +0900 Vic Trento ha scritto: > Hi, > can anybody gimme a example how crypt works with ruby, could not find > anything anywhere, just this info below, however I get all kind of > errors with my tries: Where I'm failing??? > > Tx > Dai > > > irb(main):011:0* "the_string".crypt(aa) > NameError: undefined local variable or method `aa' for main:Object > from (irb):11 > from /usr/local/bin/irb:12:in `
' > irb(main):012:0> exit > [backman@minsk ~]$ ruby -v > ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux] > > > > crypt str.crypt( aString ) -> aString > Applies a one-way cryptographic hash to str by invoking the standard > library function crypt. The argument is the salt string, which should be > two characters long, each character drawn from [a-zA-Z0-9./]. > I never used crypt, but I'm almost sure you need to quote the aa so that it is interpreted as a string rather than a variable name/method call: "the_string".crypt('aa') Stefano