From a875cd62ff0638897c05ef0aefd6718ebca6e4a1 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Thu, 4 Aug 2011 21:49:33 +0200 Subject: [PATCH 1/3] add pwgen from mazzoo --- firmware/l0dable/pwgen.c | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 firmware/l0dable/pwgen.c diff --git a/firmware/l0dable/pwgen.c b/firmware/l0dable/pwgen.c new file mode 100644 index 0000000..81575ef --- /dev/null +++ b/firmware/l0dable/pwgen.c @@ -0,0 +1,55 @@ +#include "basic/basic.h" + +#include "usetable.h" + +#define PW_LEN 8 + +void ram(void) +{ + char pw[PW_LEN+1]; + uint16_t k[8]; + int button; + memset(k, 0, 16); + while(1){ + lcdClear(); + lcdNl(); + lcdPrintln(" password"); + lcdPrintln(" generator"); + lcdNl(); + lcdNl(); + pw_set(pw,&k); + pw_cleanup(pw); + lcdPrint(" "); + lcdPrintln(pw); + lcdRefresh(); + delayms(23); + while((button=getInputRaw())==BTN_NONE) + delayms(23); + if(button==BTN_LEFT) return; + } +} + +void pw_cleanup(char * pw) +{ + int i; + for(i=0;i0x7a)pw[i]-=0x10; + if((pw[i]>'Z')&&(pw[i]<'a')) + pw[i]-=0x10; + } +} + +void pw_set(char * pw, uint16_t * k) +{ + int i; + memset(pw,0,PW_LEN); /* wipe old PW */ + for(i=0;i<4;i++) + k[1]=getRandom(); + xxtea_encode_words(pw,PW_LEN/4,k); + pw[PW_LEN]=0; +} + From 728132920601f14e956ff32eaf442c002071b1d6 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Thu, 4 Aug 2011 21:58:33 +0200 Subject: [PATCH 2/3] Fix pointer bug. Shouldn't 've worked before --- firmware/l0dable/pwgen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/firmware/l0dable/pwgen.c b/firmware/l0dable/pwgen.c index 81575ef..329f6c5 100644 --- a/firmware/l0dable/pwgen.c +++ b/firmware/l0dable/pwgen.c @@ -4,6 +4,9 @@ #define PW_LEN 8 +void pw_cleanup(char * pw); +void pw_set(char * pw, uint16_t * k); + void ram(void) { char pw[PW_LEN+1]; @@ -17,7 +20,7 @@ void ram(void) lcdPrintln(" generator"); lcdNl(); lcdNl(); - pw_set(pw,&k); + pw_set(pw,k); pw_cleanup(pw); lcdPrint(" "); lcdPrintln(pw); From 23eb8775013fffca0791538656d4920b4a2e0636 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Thu, 4 Aug 2011 22:58:36 +0200 Subject: [PATCH 3/3] Simple image converter and sample image --- tools/image/img2lcd.pl | 72 ++++++++++++++++++++++++++++++++++++++++ tools/image/src/i42.gif | Bin 0 -> 340 bytes 2 files changed, 72 insertions(+) create mode 100755 tools/image/img2lcd.pl create mode 100755 tools/image/src/i42.gif diff --git a/tools/image/img2lcd.pl b/tools/image/img2lcd.pl new file mode 100755 index 0000000..5f9fee1 --- /dev/null +++ b/tools/image/img2lcd.pl @@ -0,0 +1,72 @@ +#!/usr/bin/perl + +# img2lcd.pl - by 05/2011, BSD Licence +# +# This script converts an image to .lcd format for the r0ket + +use strict; +use warnings; +use Getopt::Long; +use Module::Load; + +$|=1; + +### +### Runtime Options +### + +my ($verbose); + +GetOptions ( + "verbose" => \$verbose, # flag + "help" => sub { + print <new($in); + + +my $w=$image->width; +my $h=$image->height; + +my @img; +for my $y (0..$h){ + for my $x (0..$w){ + my $px= $image->getPixel($x,$y); + $img[$x][$y/8]|=$px<<(7-$y%8); + if($verbose){ + $px=~y/01/ */; print STDERR $px; + }; + }; + if ($verbose){ + print STDERR "<\n"; + }; +}; + +open(F,">",$out)||die "open: $!"; + +my $hb=int($h/8); +for my $y (0..$hb){ + for my $x (0..$w){ + printf F "%c",$img[$w-$x][$hb-$y]; + }; +}; + +close(F); diff --git a/tools/image/src/i42.gif b/tools/image/src/i42.gif new file mode 100755 index 0000000000000000000000000000000000000000..acd34eeb0000209667a9c3400465c9502307d4bd GIT binary patch literal 340 zcmV-a0jvH;Nk%v~VPF760Du4h|Ns90001li0001B07L))0{(=LsmtvTqnxzbi?iOm z`wxcVNS5Y_rs~SJVF0`G0>@^J*Rz3_`QMZ2M!;flbp!z!KjiS0gG5tLWi^r{WjkA} z?e?_>FkLY*T)9HgT=m5Lfp6qqwx>L|Q|KE0j;F`rmk=m2Xn{vlxHiW4c6hgV0Xd}t zDUnEc+140$n0eM2De3?kDn{C{>6zLm3HW--iWw`**{X<3RVx*{YIaMjyF0u$WYo0t zn~U6Bd9tkOJiX+@TUvBLogG@NWmjz&ondP2-TgOCe(mU@o_8+JuKG+L-!5omKl85L ztWZuKt4`JGvFHa2ATnhL0l?wLuc4f9LgwvbmaIjsT|V&Ye7a`uqtrsL-KAiy9SL002AVRHM@X literal 0 HcmV?d00001