Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: UNIX : script help/input

RE: UNIX : script help/input

From: Jamadagni, Rajendra <Rajendra.Jamadagni_at_espn.com>
Date: Thu, 02 Oct 2003 04:54:33 -0800
Message-ID: <F001.005D1CFC.20031002045433@fatcity.com>


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




Rajendra dot Jamadagni at nospamespn dot com All Views expressed in this email are strictly personal. QOTD: Any clod can have facts, having an opinion is an art !

-----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 - 07:54:33 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US