diff -urpN john-1.7.6.orig/src/john.c john-1.7.6/src/john.c
--- john-1.7.6.orig/src/john.c	2010-06-14 01:34:04.000000000 +0000
+++ john-1.7.6/src/john.c	2011-04-04 04:22:36.000000000 +0000
@@ -38,6 +38,7 @@ extern int CPU_detect(void);
 
 extern struct fmt_main fmt_DES, fmt_BSDI, fmt_MD5, fmt_BF;
 extern struct fmt_main fmt_AFS, fmt_LM;
+extern struct fmt_main fmt_SHA256CPU;
 #ifdef HAVE_CRYPT
 extern struct fmt_main fmt_crypt;
 #endif
@@ -69,6 +70,7 @@ static void john_register_all(void)
 	john_register_one(&fmt_BF);
 	john_register_one(&fmt_AFS);
 	john_register_one(&fmt_LM);
+	john_register_one(&fmt_SHA256CPU);
 #ifdef HAVE_CRYPT
 	john_register_one(&fmt_crypt);
 #endif
diff -urpN john-1.7.6.orig/src/Makefile john-1.7.6/src/Makefile
--- john-1.7.6.orig/src/Makefile	2010-06-13 21:12:37.000000000 +0000
+++ john-1.7.6/src/Makefile	2011-04-04 04:29:13.000000000 +0000
@@ -38,7 +38,8 @@ JOHN_OBJS = \
 	recovery.o rpp.o rules.o signals.o single.o status.o tty.o wordlist.o \
 	unshadow.o \
 	unafs.o \
-	unique.o
+	unique.o \
+	sha256cpu_fmt.o
 
 BENCH_DES_OBJS_ORIG = \
 	DES_fmt.o DES_std.o
@@ -776,6 +777,9 @@ generic.h:
 		"$(BENCH_MD5_OBJS_DEPEND)" \
 		"$(BENCH_BF_OBJS_DEPEND)"
 
+sha256cpu_fmt.o: sha256cpu_fmt.c sha256.h
+	$(CC) $(CFLAGS) sha256cpu_fmt.c
+
 bench: $(BENCH_OBJS)
 	$(LD) $(BENCH_OBJS) $(LDFLAGS) -o bench
 
diff -urpN john-1.7.6.orig/src/options.c john-1.7.6/src/options.c
--- john-1.7.6.orig/src/options.c	2010-06-12 14:03:50.000000000 +0000
+++ john-1.7.6/src/options.c	2011-04-02 01:34:18.000000000 +0000
@@ -101,7 +101,7 @@ static struct opt_entry opt_list[] = {
 "--salts=[-]COUNT           load salts with[out] at least COUNT passwords " \
 	"only\n" \
 "--format=NAME              force hash type NAME: " \
-	"DES/BSDI/MD5/BF/AFS/LM/crypt\n" \
+	"DES/BSDI/MD5/BF/AFS/LM/crypt/SHA256CPU\n" \
 "--save-memory=LEVEL        enable memory saving, at LEVEL 1..3\n"
 
 void opt_init(char *name, int argc, char **argv)
diff -urpN john-1.7.6.orig/src/sha256cpu_fmt.c john-1.7.6/src/sha256cpu_fmt.c
--- john-1.7.6.orig/src/sha256cpu_fmt.c	1970-01-01 00:00:00.000000000 +0000
+++ john-1.7.6/src/sha256cpu_fmt.c	2011-04-04 04:27:08.000000000 +0000
@@ -0,0 +1,250 @@
+/*
+* This software is Copyright (c) 2011 Lukas Odzioba
+* <lukas dot odzioba at gmail dot com> 
+* and it is hereby released to the general public under the following terms:
+* Redistribution and use in source and binary forms, with or without modification, are permitted.
+*/
+#include <string.h>
+#include "arch.h"
+#include "formats.h"
+#include "common.h"	///for ARCH_WORD_32,atoi16
+#include "misc.h"	///for strnzcpy
+#include "sha256.h"
+
+#define FORMAT_LABEL		"sha256cpu" 
+#define FORMAT_NAME		"SHA256CPU"
+
+#define SHA_TYPE		"SHA256" 
+
+#define BENCHMARK_COMMENT	""
+#define BENCHMARK_LENGTH	-1
+
+#define PLAINTEXT_LENGTH	54
+#define CIPHERTEXT_LENGTH	64 ///256bit
+#define BINARY_SIZE		32 
+
+#define SALT_SIZE		0
+
+#define MIN_KEYS_PER_CRYPT	64	
+#define MAX_KEYS_PER_CRYPT	64
+
+static char saved_keys[MAX_KEYS_PER_CRYPT][PLAINTEXT_LENGTH+1];		/** plaintext ciphertexts **/
+static sha256_password 	inbuffer[MAX_KEYS_PER_CRYPT];			/** binary ciphertexts **/
+static sha256_hash	outbuffer[MAX_KEYS_PER_CRYPT];			/** calculated hashes **/
+
+static uint32_t w[64]={0};
+static const uint32_t _h[]={0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
+static const uint32_t k[]={
+   0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
+   0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
+   0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
+   0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
+   0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
+   0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
+   0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
+   0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2};
+
+static void preproc(char *key, int index){
+  uint32_t dl=strlen(key),j;
+  uint32_t *blocks = inbuffer[index].v;
+  memset(inbuffer[index].v,0,sizeof(sha256_password));
+  for(j=0;j<dl;j++){
+      uint tmp=0;
+      if(j%4==0) tmp|=(((uint)key[j])<<24);
+      if(j%4==1) tmp|=(((uint)key[j])<<16);
+      if(j%4==2) tmp|=(((uint)key[j])<<8);
+      if(j%4==3) tmp|=((uint)key[j]);
+      blocks[j/4]|=tmp;
+    }
+    if(j%4==0) blocks[j/4]|=(((uint)0x80)<<24);
+    if(j%4==1) blocks[j/4]|=(((uint)0x80)<<16);
+    if(j%4==2) blocks[j/4]|=(((uint)0x80)<<8);
+    if(j%4==3) blocks[j/4]|=(((uint)0x80));
+    blocks[15]=0x00000000|(dl*8);
+}
+void calcw(int index){
+ int j;
+ uint32_t *p=inbuffer[index].v;
+ for(j=0;j<16;j++)
+   w[j]=p[j];
+ for(;j<64;j++)
+   w[j]=sigma1(w[j-2])+w[j-7]+sigma0(w[j-15])+w[j-16];
+}
+ void sha256(int index){
+  int j;
+  uint32_t *hash=outbuffer[index].v;
+  uint32_t a=_h[0];uint32_t b=_h[1];uint32_t c=_h[2];uint32_t d=_h[3];
+  uint32_t e=_h[4];uint32_t f=_h[5];uint32_t g=_h[6];uint32_t h=_h[7];
+  for(j=0;j<64;j++){
+   uint32_t t1=h+Sigma1(e)+Ch(e,f,g)+k[j]+w[j];
+   uint32_t t2=Sigma0(a)+Maj(a,b,c);
+   h=g;g=f;f=e;e=d+t1;d=c;c=b;b=a;a=t1+t2;
+  }
+  hash[0]=a+_h[0];hash[1]=b+_h[1];
+  hash[2]=c+_h[2];hash[3]=d+_h[3];
+  hash[4]=e+_h[4];hash[5]=f+_h[5];
+  hash[6]=g+_h[6];hash[7]=h+_h[7];
+}
+
+static struct fmt_tests tests[]={
+  {"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad","abc"},
+  {"96d9632f363564cc3032521409cf22a852f2032eec099ed5967c0d000cec607a","john"},
+  {"5d5b09f6dcb2d53a5fffc60c4ac0d55fabdf556069d6631545f42aa6e3500f2e","sha256"},
+  {"a49c2c9d0c006c8cb55a9a7a38822b83e0cd442614cb416af952fa50156761dc","openwall"},
+  {"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",""},
+  {NULL}  
+};
+
+static void init(void){}
+
+static int valid(char * ciphertext){
+  int i;
+  if(strlen(ciphertext)!=CIPHERTEXT_LENGTH) return 0;
+  for(i=0;i<CIPHERTEXT_LENGTH;i++){
+    if(!(
+      (ciphertext[i]>='0' && ciphertext[i]<='9')||
+      (ciphertext[i]>='a' && ciphertext[i]<='f')||
+      (ciphertext[i]>='A' && ciphertext[i]<='Z')))
+	return 0;
+  }
+  return 1;
+};
+
+static void *binary(char *ciphertext){
+  static char realcipher[BINARY_SIZE];
+  memset(realcipher,0,BINARY_SIZE);
+  int i;
+  for(i=0;i<BINARY_SIZE;i+=4){
+      realcipher[i]=atoi16[ARCH_INDEX(ciphertext[(i+3)*2])]*16+atoi16[ARCH_INDEX(ciphertext[(i+3)*2+1])];
+      realcipher[i+1]=atoi16[ARCH_INDEX(ciphertext[(i+2)*2])]*16+atoi16[ARCH_INDEX(ciphertext[(i+2)*2+1])];
+      realcipher[i+2]=atoi16[ARCH_INDEX(ciphertext[(i+1)*2])]*16+atoi16[ARCH_INDEX(ciphertext[(i+1)*2+1])];
+      realcipher[i+3]=atoi16[ARCH_INDEX(ciphertext[(i)*2])]*16+atoi16[ARCH_INDEX(ciphertext[(i)*2+1])];
+  }
+  return (void*)realcipher;
+}
+
+static int binary_hash_0(void *binary){
+  return (((ARCH_WORD_32*)binary)[0] & 0xf);
+}
+
+static int binary_hash_1(void *binary){
+  return ((ARCH_WORD_32*)binary)[0] & 0xff;
+}
+
+static int binary_hash_2(void *binary){
+  return ((ARCH_WORD_32*)binary)[0] & 0xfff;
+}
+
+static int binary_hash_3(void *binary){
+  return ((ARCH_WORD_32*)binary)[0] & 0xffff;
+}
+
+static int binary_hash_4(void *binary){
+  return ((ARCH_WORD_32*)binary)[0] & 0xfffff;
+}
+
+static void set_salt(void *salt){}
+static void set_key(char *key, int index){
+    memset(saved_keys[index],0,PLAINTEXT_LENGTH+1);	
+    strnzcpy(saved_keys[index],key,PLAINTEXT_LENGTH);
+    preproc(key,index);
+}
+static char *get_key(int index){
+  return saved_keys[index];
+}
+
+static void crypt_all(int count){
+  int i;
+  for(i=0;i<MIN_KEYS_PER_CRYPT;i++){
+   calcw(i);
+   sha256(i);
+  }
+}
+
+static int get_hash_0(int index){
+  return ((ARCH_WORD_32*)outbuffer[index].v)[0] & 0xf;
+}
+
+static int get_hash_1(int index){
+  return ((ARCH_WORD_32*)outbuffer[index].v)[0] & 0xff;
+}
+
+static int get_hash_2(int index){
+  return ((ARCH_WORD_32*)outbuffer[index].v)[0] & 0xfff;
+}
+
+static int get_hash_3(int index){
+  return ((ARCH_WORD_32*)outbuffer[index].v)[0] & 0xffff;
+}
+
+static int get_hash_4(int index){
+  return ((ARCH_WORD_32*)outbuffer[index].v)[0] & 0xfffff;
+}
+
+static int cmp_all(void *binary,int count){
+  uint32_t i;
+  uint32_t b=((uint32_t *)binary)[0];
+  for(i=0;i<count;i++)
+    if(b==outbuffer[i].v[0])
+      return 1;
+  return 0;
+}
+
+static int cmp_one(void *binary,int index){
+  int i;
+  uint32_t *t=(uint32_t *)binary;
+  for(i=0;i<8;i++)
+    if(t[i]!=outbuffer[index].v[i])
+      return 0;
+  return 1;
+}
+static int cmp_exact(char *source,int count){
+  return 1;
+}
+
+struct fmt_main fmt_SHA256CPU={
+  {
+    FORMAT_LABEL,
+    FORMAT_NAME,
+    SHA_TYPE,
+    BENCHMARK_COMMENT,
+    BENCHMARK_LENGTH,
+    PLAINTEXT_LENGTH,
+    BINARY_SIZE,
+    SALT_SIZE,
+    MIN_KEYS_PER_CRYPT,
+    MAX_KEYS_PER_CRYPT,
+    FMT_CASE | FMT_8_BIT ,
+    tests
+  },
+  {
+    init,
+    valid,
+    fmt_default_split,
+    binary,
+    fmt_default_salt,
+    {
+      binary_hash_0,	
+      binary_hash_1,	
+      binary_hash_2,	
+      binary_hash_3,
+      binary_hash_4
+    },
+    fmt_default_salt_hash,
+    set_salt,
+    set_key,
+    get_key,	
+    fmt_default_clear_keys,
+    crypt_all,
+    {
+      get_hash_0,	
+      get_hash_1,	
+      get_hash_2,
+      get_hash_3,
+      get_hash_4
+    },
+    cmp_all,	
+    cmp_one,	
+    cmp_exact	
+  }
+};
\ Brak znaku nowej linii na końcu pliku
diff -urpN john-1.7.6.orig/src/sha256.h john-1.7.6/src/sha256.h
--- john-1.7.6.orig/src/sha256.h	1970-01-01 00:00:00.000000000 +0000
+++ john-1.7.6/src/sha256.h	2011-04-04 04:26:22.000000000 +0000
@@ -0,0 +1,25 @@
+#ifndef _SHA256_H
+#define _SHA256_H
+
+#ifndef uint32_t
+  #define uint32_t unsigned int  
+#endif
+
+#define rol(x,n) ((x << n) | (x >> (32-n)))	///todo change to hardware ror
+#define ror(x,n) ((x >> n) | (x << (32-n)))
+#define Ch(x,y,z) ((x & y) ^ ( (~x) & z))
+#define Maj(x,y,z) ((x & y) ^ (x & z) ^ (y & z))
+#define Sigma0(x) ((ror(x,2))  ^ (ror(x,13)) ^ (ror(x,22)))
+#define Sigma1(x) ((ror(x,6))  ^ (ror(x,11)) ^ (ror(x,25)))
+#define sigma0(x) ((ror(x,7))  ^ (ror(x,18)) ^(x>>3))
+#define sigma1(x) ((ror(x,17)) ^ (ror(x,19)) ^(x>>10))
+
+typedef struct{
+  uint32_t v[16];  	///512bit 
+}sha256_password;
+
+typedef struct{
+  uint32_t v[8]; 	///256bit
+}sha256_hash;
+
+#endif
\ Brak znaku nowej linii na końcu pliku
