From: Todd Benson Date: 2008-02-07T10:11:37+09:00 Subject: Re: Strange characters... how are they created? On Feb 6, 2008 6:22 PM, Daniel Waite wrote: > Todd Benson wrote: > > I don't know anything about bittorrent, but > > > > s = '20:Ÿø\îµÊ^Ω¬ ‡m$æÉ* ú0*' > > puts s.unpack('h*') > > > > might point you in the right direction. > > That's an interesting operation, but nay, no directional change. (Also, > pasting it into IRB causes my machine to beep and pause. Dunno why > though. Perhaps the characters being pasted mean something special to > Ruby?) I think it has to do with your console. It also doesn't work for me when pasting into IRB, but seems to work when running with ruby from a .rb file. > I asked a friend of mine and he said that if you dump the output of the > digest method directly to a file, you'll get the funky output. I guess that makes sense. > My guess is console does some kind of conversion -- possibly with > character encoding? I think so. > Anywho, the following... > > require 'digest/sha1' > > output = File.open('output', 'w+') > source = IO.read('./README_FOR_APP', 512) > output << Digest::SHA1.digest(source) > output.close > > Yields the same "style" output that Transmission generates. But not the same? From your original post with my code, I get... 2303a3f98fc5ee5bace5f4ca0278d6426e9ca202af03a2 ...which if you leave off the first three bytes (20:) should be a reasonable sha1 digest of 160 bits length. Todd