|
Text to Binary Encoder Ruby
|
|
05-15-2010, 10:38 PM
(This post was last modified: 08-06-2010 05:11 PM by codecaine.)
Post: #1
|
|||
|
|||
|
Text to Binary Encoder Ruby
This program converts plain text into 8 bit binary
PHP Code: =begin |
|||
|
05-16-2010, 01:14 AM
Post: #2
|
|||
|
|||
|
RE: Text to Binary Encoder Ruby
Great example ! I don't get it till the end. Does it convert ASCII values or ???
There's a fine line between genius and insanity. I have erased this line. Oscar Levant There's a fine line between an administrator and black hat hacker. I have erased this line. Dr DEBCOL |
|||
|
05-16-2010, 01:33 AM
Post: #3
|
|||
|
|||
|
RE: Text to Binary Encoder Ruby
yea it takes the ordinal values of each chracters and convert it to 8 bit binary string. So each characters has a total of eight 1's and 0's when the number is converted and doesn't have 8 characters long, I pad the beginning of the binary string with 0's
|
|||
|
05-16-2010, 01:37 AM
Post: #4
|
|||
|
|||
RE: Text to Binary Encoder Ruby
(05-16-2010 01:33 AM)codecaine Wrote: yea it takes the ordinal values of each chracters and convert it to 8 bit binary string. So each characters has a total of eight 1's and 0's when the number is converted and doesn't have 8 characters long, I pad the beginning of the binary string with 0'sYeah ordinal values like ord() function in Pascal. It returns ASCII value (0..255) of character that you entered. There's a fine line between genius and insanity. I have erased this line. Oscar Levant There's a fine line between an administrator and black hat hacker. I have erased this line. Dr DEBCOL |
|||
|
05-16-2010, 01:47 AM
Post: #5
|
|||
|
|||
|
RE: Text to Binary Encoder Ruby
Yea in ruby if you only return 1 character from a string it returns the ord unless you add .chr at the end
|
|||
|
« Next Oldest | Next Newest »
|





