Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: UNIX : script help/input
unfortunately we _had_ to do it in pl/sql ... it is part of the encrypted
feed that we send out to our clients ... it is decoded by a chip.
Oh well .... I am back to array of references ...
Raj
-----Original Message-----
Sent: Thursday, October 02, 2003 2:20 PM
To: Multiple recipients of list ORACLE-L
Raj,
I did consider doing it this way, but the thought of writing stuff to the bit level for a prototype was just too painful.
Left pad with zeroes, take a substring, feed it to the handy-dandy hex/oct/bin/dec converter package - much easier.
Jared
"Jamadagni, Rajendra" <Rajendra.Jamadagni_at_espn.com> Sent by: ml-errors_at_fatcity.com
10/02/2003 05:54 AM
Please respond to ORACLE-L
To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> cc: Subject: RE: UNIX : script help/input
XOR .... that gives me some painful memories in recent days ... xor is possible in pl/sql but needs a little work. I migrated a "C" encryption code to pl/sql and then use utl_tcp to sent it to our router which feeds the modem banks.
This is how I worked on it ... but I was working on character by character ..
xor(a,b) is
r_a := utl_raw.cast_to_raw(chr(a)); r_b := utl_raw.cast_to_raw(chr(b)); n_xor := to_number(utl_raw.bit_xor(r_a,r_b),'xxxx');
Of course the manual doesn't tell you this ...
Raj
-----Original Message-----
Sent: Wednesday, October 01, 2003 6:29 PM
To: Multiple recipients of list ORACLE-L
> Good! The more the merrier! Welcome to the club.
Oh most definitely.
As I just finished writing a prototype package for assigning MAC addresses ( we make network stuff - that's a technical term ), I have endured the agonies of doing hex math in PL/SQL.
I finally bit the bullet and used string manipulation to convert hex to decimal and do what I needed that way. Couldn't get BITAND to work properly on very large integers. Besides, doing XOR with BITAND in PL/SQL is very painful.
UTL_RAW has an XOR, but it requires RAW values and I didn't feel like messing with it.
This is all very simple in Perl.
Given a MAC of 000050000AA, with a fixed portion of 00005000000, it is very easy to determine the variable portion of the address via $x = 0x000050000AA ^ 00005000000.
Not quite so simple in PL/SQL.
Jared
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jamadagni, Rajendra INET: Rajendra.Jamadagni_at_espn.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Thu Oct 02 2003 - 14:04:44 CDT
![]() |
![]() |