Log in

No account? Create an account

Previous | Next

Project stuff

I finally figured the last problem with my program now it's all subroutined out. I include this in the hopes that other Perl people won't make the same stupid mistake.

So I'm trying to copy a list-of-lists, then do something with the new list. Bear in mind that I'm reasonably new to working with LoLs and thus don't know why, once I have finished adding columns to the second one, the columns are also present in the first. That's becausee I was using

@NewLoL = @LoL;

#add some columns to @NewLoL, actual code is 
#incidental but it was to compute the full 4x44 key block 
#for the AES. 

#getdim is a routine to return the number of rows and
#columns in a LoL
($row, $col) = getdim(@LoL);

print "$col";

$col was turning out to be 44, when to my eyes it should have been 4. Wrong. After the first line, both @lol and @NewLoL were lists containing references to the anonymous lists that was the rows. As I was adding to those rows when I manipulated @NewLoL, the arrays were growing, and thus when I used @LoL, these were the same arrays referred to in @NewLoL.

Only once I had implemented a very fast deep copy which would get the first 4x4 of @NewLoL did the program work, and it took half an hour afterwards of hard thinking for me to finally grok why I had needed to perform a deep copy.

Yeah, I'm an idiot. But I'll never make that mistake again.

Now, I relax for some and star working on decryption. Of course, I need to find the inverse Sbox as it's not provided anywhere in the book and I'm fucked if I'm doing yet more matrix multiplication in GF(2^8). But this should now be easy.


( 5 informants — We want information! )
Feb. 26th, 2003 06:27 pm (UTC)
Yeah, I'm an idiot. But I'll never make that mistake again.

if you're an idiot, what does that make the rest of us?
Feb. 26th, 2003 09:09 pm (UTC)
God, Amokk, you're dumb...
@NewLoL = @LoL;

It's simple, let me translate.

>>#add some columns to @NewLoL,<<

There's a funny newspaper column...with new stuff in it.

>>actual code is #incidental but it was to compute the full 4x44 key block #for the AES.<<

The American Earlobe Society are having trouble with their computers and incidentally, they live around the block. Here's a key to their apartment.

>>#getdim is a routine to return the number of rows and
#columns in a LoL<<

His friend Get is a bit dim and his life is an endless routine where he works at a job involving returning some amusing rows and columns.

>>($row, $col) = getdim(@LoL); print "$col";<<

The rows and columns are worth serious dollars, and Get (who is dim) thinks it's real funny. Funny enough to print in the paper.

I thought all that was obvious.

Feb. 27th, 2003 03:36 am (UTC)
Re: God, Amokk, you're dumb...
Fuck. It's interpretations like that that make me realize just how much I love you, MFP. The scariest part is that after I got done laughing I came to realize that your translation made far more sense to me than Stew's code did. It's like watching two geniuses working in their respected mediums: programming and comedy, respectively.
Feb. 27th, 2003 10:02 am (UTC)
Re: God, Amokk, you're dumb...
Oddly enough, there was a time when I would have understood Stew's code. That was before having a job working the corner office as a corporate whore atrophied my brain to such things.

That said, I prefer MFP's interpretation.

Feb. 27th, 2003 10:37 am (UTC)
Fuck that, I prefer MFP's interpretation. If only it were that simple.
( 5 informants — We want information! )



Powered by LiveJournal.com
Designed by Lilia Ahner