Re: [SLUG] Perl Question

From: Dylan Hardison (dylanwh@gmail.com)
Date: Tue Mar 22 2005 - 19:26:10 EST


On Tue, 22 Mar 2005 17:59:23 -0500 (EST), Kwan Lowe
<kwan@digitalhermit.com> wrote:
> Set some $mask containing your mask character equal to the length of $buff
> then do the XOR. Not sure of the behaviour if you XOR a byte against a
> multi-byte string...

hex() returns a number, not a string.

> On a side note, way back we used a similar technique to do simple animation.
> But XORing a bitfield, then XORing again you could restore the original bits.
> >
> >
> >
> > It has nothing to do with SRC or DEST - this is a code snippit.
> >
> > What isn't working is
> > while(read(BRIEF, $buff, 2)){
> > $buff = hex ($buff) ^ 0xAA;
> > print DEST $buff;
> > }
> >
> > specifically, the XOR
> >
> > On Tue, 22 Mar 2005, Chris Moore wrote:
> >
> >> Even your typo fix appears to be wrong. Maybe the problem is that you should
> >> be reading 'SRC' and not 'DEST'. Assuming 'DEST' is empty until you print to
> >> it then the answer your getting would make since if your reading 'DEST' for
> >> your input.
> >> Chris Moore
> >> cmoore@washpat.com
> >> ----- Original Message -----
> >> From: <mark@bish.net>
> >> To: <slug@nks.net>
> >> Sent: Tuesday, March 22, 2005 3:39 PM
> >> Subject: Re: [SLUG] Perl Question
> >>
> >>
> >>>
> >>>
> >>> Ignore the typo:
> >>> (read(BRIEF
> >>>
> >>> it should say:
> >>> (read(DEST
> >>>
> >>> On Tue, 22 Mar 2005 mark@bish.net wrote:
> >>>
> >>>>
> >>>> Why doesn't this work?
> >>>>
> >>>> open(SRC, "<$file1") or die "Can't open for reading: $!\n";
> >>>> open(DEST, ">$file2") or die "Can't open for reading: $!\n";
> >>>>
> >>>> binmode(SRC);
> >>>> binmode(DEST);
> >>>>
> >>>> while(read(BRIEF, $buff, 2)){
> >>>> $buff = hex ($buff) ^ 0xAA;
> >>>> print DEST $buff;
> >>>> }
> >>>>
> >>>> close(DEST);
> >>>> close(SRC);
> >>>>
> >>>>
> >>>>
> >>>> I get a text file filled with 170, which is 0xAA.
> >>>> -----------------------------------------------------------------------
> >>>> This list is provided as an unmoderated internet service by Networked
> >>>> Knowledge Systems (NKS). Views and opinions expressed in messages
> >>>> posted are those of the author and do not necessarily reflect the
> >>>> official policy or position of NKS or any of its employees.
> >>>>
> >>> -----------------------------------------------------------------------
> >>> This list is provided as an unmoderated internet service by Networked
> >>> Knowledge Systems (NKS). Views and opinions expressed in messages
> >>> posted are those of the author and do not necessarily reflect the
> >>> official policy or position of NKS or any of its employees.
> >>>
> >>>
> >>
> >> -----------------------------------------------------------------------
> >> This list is provided as an unmoderated internet service by Networked
> >> Knowledge Systems (NKS). Views and opinions expressed in messages
> >> posted are those of the author and do not necessarily reflect the
> >> official policy or position of NKS or any of its employees.
> >>
> > -----------------------------------------------------------------------
> > This list is provided as an unmoderated internet service by Networked
> > Knowledge Systems (NKS). Views and opinions expressed in messages
> > posted are those of the author and do not necessarily reflect the
> > official policy or position of NKS or any of its employees.
> >
>
> --
> * The Digital Hermit http://www.digitalhermit.com
> * Unix and Linux Solutions kwan@digitalhermit.com
> -----------------------------------------------------------------------
> This list is provided as an unmoderated internet service by Networked
> Knowledge Systems (NKS). Views and opinions expressed in messages
> posted are those of the author and do not necessarily reflect the
> official policy or position of NKS or any of its employees.
>
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 16:20:02 EDT