## Extracting GUIDs from a bunch of text

As part of messing with Windows Performance Recorder profiles, I had a need to extract everything that looks like a GUID from a blob of text. So I wrote this script. It digs through its STDIN and outputs all the GUID-looking things, uppercase-ized and sorted. https://github.com/mvaneerde/blog/blob/master/scripts/extract-guids.pl

## Perl scripts to encrypting and decrypt text using Rijndael

I talked about Rijndael in a few previous posts: Expressing a function f: GF(2⁸) → GF(2⁸) as a polynomial using a Lagrange polynomial, Generating the Rijndael S-box, Efficient multiplication and division in GF(28), Sieving irreducible monic polynomials over a finite field, Addition and multiplication table for GF(22). Today I wrote a couple of Perl scripts…

## Sieving irreducible monic polynomials over a finite field

Last time we talked about the addition and multiplication tables for GF(2²); GF(28) is relevant for the Rijndael encryption scheme. Joan Daemen and Vincent Rijmen use a representation of GF(28) where each element is a polynomial of the form b7x7 + b6x6 + b5x5 + b4x4 + b3x3 + b2x2 + b1x + b0, with the…

## Perl script to parse MPEG audio header

I’ve written a perl script (attached) which will parse MPEG audio headers and display them in a human-readable format. For example, if you run it on ding.mpeg (also attached) you get this output: >perl mpegaudioheader.pl ding.mpeg Frame header: 11111111 111 (should be all ones) MPEG Audio version ID: 11 (MPEG version 1 (ISO/IEC 11172-3)) Layer…

## Perl one-liner: approximate pi via Monte Carlo method

http://programmingpraxis.com/2009/10/09/calculating-pi/ >perl -e”print 4/(map{\$n+=rand()**2+rand()**2<1}1..pop)*\$n” 5000 3.1336 59 characters, plus arguments.

Bad Perl solution to the “print the open lockers” problem: perl -e”print join’, ‘,map{\$_*\$_}1..sqrt pop” 100 54 characters.  I prefer this to the 53-character solution obtained by omitting the space after the first comma. EDIT: 49 characters: perl -e”print map{\$_*\$_,’ ‘}1..sqrt pop” 100 EDIT: 48: perl -e”print map{\$_*\$_.\$/}1..sqrt pop” 100 EDIT: 47: perl -e”map{print\$/.\$_*\$_}1..sqrt pop”…