Vulnerability Development mailing list archives

Re: combinations of 4


From: Sebastian Jaenicke <tsa () jaenicke org>
Date: Sun, 7 Apr 2002 22:05:58 +0200

Hi,

On Sat, Apr 06, 2002 at 05:01:59PM -0800, KF wrote:
I am in the process of archiving power pc instructions that do not 
contain null... I have come to the decision that if I could generate a 
list of all possible unique 4 char combinations for a given list of 
alpha numeric chars then I could quickly sort the rest out in gdb...

My question is does anyone know how to programatically do this? Do i 
need to make use of bit shifting or something? I need only a program to 
print the list to the screen or something simple. Example output would 
be ...

AAAA
BBBBB
....
AAAB
AAAC
...
and so on but ONLY unique posibilities.

#!/bin/bash

alphabet="a b c d e f"

for a in $alphabet; do
  for b in $alphabet; do
    for c in $alphabet; do
      for d in $alphabet; do
        echo $a$b$c$d;
      done
    done
  done
done


Should give you the desired output.

Regards,

Sebastian
-- 
Sebastian Jaenicke
whois pgpkey-18AC0BE4 () whois ripe net|perl -ne's-^certif: +--&&print'
  "Object-oriented programming is an exceptionally bad idea which
   could only have originated in California." --Edsger Dijkstra  

Attachment: _bin
Description:


Current thread: