Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Have you read SICP?

Name: Anonymous 2011-08-04 15:23

Okay, which one of you is responsible for this?

http://news.ycombinator.com/item?id=2846799

Name: Anonymous 2011-08-04 15:25

The jews are after me.

Name: Anonymous 2011-08-04 15:32

Oniichan is inside me.

Name: Anonymous 2011-08-04 16:19

Do EXPERT PROGRAMMERS really need to READ SICP?

Name: Anonymous 2011-08-04 16:26

>>4
Yes. Read more SICP now.

Name: Anonymous 2011-08-04 16:27

>>4
They're EXPERT PROGRAMMERS precisely because they have read SICP. Also, your post lacks industry-standard `buio' BBCode tags which are required in order to give the most pleasurable /prog/-browsing experience to the reader.

Name: Anonymous 2011-08-04 18:59

>>6
The standard is b.i.o.u

Name: Anonymous 2011-08-06 1:10

SICP?
Never seen it before...
Rather not see it again

Lisp Bah Try

In File A.c
System("./tcc -run B.c");

Just as good?

Name: n3n7i 2011-08-06 2:24

Here's a Cryptographic(possibly?) Hash Function...(No SICP Required)...
Its probably pretty terrible atm... (But i designed it myself =)
[Fairly Old Version] // tweaked just today =O

Can you break it anon?
---2048-bits won't be getting brute forced anytime soon ;)
---+4096-bit-state for nCollision Resistance

//---------------//        DEF        //---------------//

#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <io.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>

//---------------

#define NumBase 256
#define DuoBase NumBase + NumBase

//#define RoundXBase 3

#define iToHex "?0123456789ABCDEF!"

#define ChopBit 128
#define ShiftBits 1+2+4+8

#define ValMax 256

#define BlockMax 256

//---------------//       GLOBAL      //---------------//

short b_Duo[DuoBase];

short     A_Jar[NumBase];

short     B_Jar[NumBase];
short     C_Jar[NumBase];
short     D_Jar[NumBase];
short     E_Jar[NumBase];
short     F_Jar[NumBase];
short     G_Jar[NumBase];

short     xK_Jar[NumBase];
short     xI_Jar[NumBase];
short     xO_Jar[NumBase];
short     xV_Jar[NumBase];

short     Out_Lx[NumBase];
short     Out_Fx[NumBase];
//short     Out_Fy[NumBase];
short     Out_Fz[NumBase];

char    XHash[1000];

char *buffer;

clock_t timeX, timeY, timeZ;
FILE *FX;

short     XB1, XB2;
short     iHX2;
int ibM=0, ibN=0, ibO=0, ibP=0, ibQ=0, ibR=0, ibS=0, ibT=0;

long     l_KeepVal=0;
short     s_KeepVal=0;

//-----------------------------------------------------------//
/*---Original Code by n3n7i ~'05-onward----------------------*/
/*-----------------------------------------------------------*/
/*----(Lotus [vX4i(/i+)]/</ Nonentity /</ Hive vX)-----------*/
//-----------------------------------------------------------//
/*----Free to use/modify/distribute/etc----------------------*/
/*------Please retain / append this Comment as Required------*/
//-----------------------------------------------------------//


//---------------//        AXIS      //---------------//

void InitDuo(){
short iDo=0;
for(iDo=0;iDo<NumBase;iDo++){
    b_Duo[iDo] = iDo;
    b_Duo[iDo+NumBase] = iDo;
    }
}

//--------------

//---------------//        JAR      //---------------//


void ResetA(){
int Ri=0;
for (Ri=0;Ri<NumBase;Ri+=2){ A_Jar[Ri]=Ri; A_Jar[Ri+1]=Ri+1;}
}

//---------------

int ModX(int ValM, int ByValM){
int V=ValM;
int BV=ByValM;
if (BV==0){ BV++;}
while (V>=BV){ V-=BV;}
return V;
}

//---------------

int NewKeyByte(int NewBase){
int x=rand();
int y=ModX(x, NewBase);
return y;
}

//---------------

int ShiftA(int ByValS, int LessVals){
int Si=ByValS;
//if (Si==0){ Si++;}
int SA=A_Jar[Si];
for (Si=ByValS;Si<LessVals;Si++){ A_Jar[Si]= A_Jar[Si+1];}
return SA;
}

//---------------

void PrintKey(short X_Jar[]){
int PKey=0;
for (PKey=0;PKey<NumBase;PKey++){
    printf("%i,", X_Jar[PKey]);
    }
    printf("\n");
}

//---------------

void PrintKeyX(short X_Jar[], char XStr[]){
int PKey=0;
for (PKey=0;PKey<NumBase;PKey++){
    printf("%c", iToHex[X_Jar[PKey]+1]);
    }
    printf("  %s\n", &XStr[0]);
}


//---------------
void NewKey(short Nin_Jar[]){
int Ni=0;
int iKey=0;
ResetA();
for (Ni=0;Ni<NumBase;Ni++){
    iKey = NewKeyByte(NumBase-Ni);
    Nin_Jar[Ni] = ShiftA(iKey, NumBase - Ni);
    }
//PrintKey(Nin_Jar);
}

//---------------//        JAR-E      //---------------//

void KeySquare(short Val_Jar[], short By_Jar[]){
int Ki=0;
for (Ki=0;Ki<NumBase;Ki+=4){
    A_Jar[Ki] = Val_Jar[By_Jar[Ki]];
    A_Jar[Ki+1] = Val_Jar[By_Jar[Ki+1]];
    A_Jar[Ki+2] = Val_Jar[By_Jar[Ki+2]];
    A_Jar[Ki+3] = Val_Jar[By_Jar[Ki+3]];
    }
for (Ki=0;Ki<NumBase;Ki+=4){
    Val_Jar[Ki] = A_Jar[Ki];
    Val_Jar[Ki+1] = A_Jar[Ki+1];
    Val_Jar[Ki+2] = A_Jar[Ki+2];
    Val_Jar[Ki+3] = A_Jar[Ki+3];
    }
}

//---------------

void DblKS(short Out_Jar[], short By_Jar1[], short By_Jar2[]){
int Ki=0;
for (Ki=0;Ki<NumBase;Ki+=4){
    A_Jar[By_Jar1[Ki]] = By_Jar2[Out_Jar[Ki]];
    A_Jar[By_Jar1[Ki+1]] = By_Jar2[Out_Jar[Ki+1]];
    A_Jar[By_Jar1[Ki+2]] = By_Jar2[Out_Jar[Ki+2]];
    A_Jar[By_Jar1[Ki+3]] = By_Jar2[Out_Jar[Ki+3]];
    }
for (Ki=0;Ki<NumBase;Ki+=4){
    Out_Jar[Ki] = A_Jar[Ki];
    Out_Jar[Ki+1] = A_Jar[Ki+1];
    Out_Jar[Ki+2] = A_Jar[Ki+2];
    Out_Jar[Ki+3] = A_Jar[Ki+3];
    }
}

/* Part I */

Name: Anonymous 2011-08-06 2:24

//---------------Part II

void KeySet(short Val_JarKS[], short By_JarKS[]){
int Ki=0;
int KS=0;
for (Ki=0;Ki<NumBase;Ki++){ Val_JarKS[Ki] = By_JarKS[Ki];}
}

//---------------
//---------------

void KGenI(int SVal){
 srand(SVal);
 NewKey(B_Jar);
 NewKey(C_Jar);
 NewKey(D_Jar);
 NewKey(E_Jar);
 NewKey(F_Jar);
 NewKey(G_Jar);
}

//---------------

void KShift(){
int iKS;
for (iKS=0;iKS<NumBase;iKS+=4){
    xV_Jar[iKS] = xO_Jar[iKS];     xO_Jar[iKS] = xI_Jar[iKS];   
    xI_Jar[iKS] = xK_Jar[iKS];     xK_Jar[iKS] = E_Jar[iKS];
   
    xV_Jar[iKS+1] = xO_Jar[iKS+1];  xO_Jar[iKS+1] = xI_Jar[iKS+1];   
    xI_Jar[iKS+1] = xK_Jar[iKS+1];  xK_Jar[iKS+1] = E_Jar[iKS+1];

    xV_Jar[iKS+2] = xO_Jar[iKS+2];  xO_Jar[iKS+2] = xI_Jar[iKS+2];   
    xI_Jar[iKS+2] = xK_Jar[iKS+2];  xK_Jar[iKS+2] = E_Jar[iKS+2];

    xV_Jar[iKS+3] = xO_Jar[iKS+3];  xO_Jar[iKS+3] = xI_Jar[iKS+3];   
    xI_Jar[iKS+3] = xK_Jar[iKS+3];  xK_Jar[iKS+3] = E_Jar[iKS+3];
    }

}

//---------------

void KSched(){
 KShift();
 //DblKS(D_Jar, C_Jar, B_Jar);
 KeySquare(G_Jar, F_Jar);
 DblKS(E_Jar, D_Jar, G_Jar);

 //PrintKeyX(E_Jar, "E_Jar");
 //PrintKeyX(xK_Jar, "k_Jar");
 //PrintKeyX(xI_Jar, "i_Jar");
 //PrintKeyX(xO_Jar, "o_Jar");
 //PrintKeyX(xV_Jar, "v_Jar");
//printf("\n");
}

//---------------

void PrimeCell(){
int iKV;
for (iKV=1;iKV<=5;iKV++){ KSched();}
KeySet(Out_Fx, xK_Jar);
KeySet(Out_Fz, xO_Jar);
}

//---------------//        HAshI      //---------------//
//---------------

short H_Axis1(short HKey, short HInput){
return xK_Jar[ (xO_Jar[HKey]  ^ xV_Jar[HInput]) ];
}

//---------------
short H_Axis2(short HKey, short HInput){
return xO_Jar[ (xK_Jar[HKey]  ^ xI_Jar[HInput]) ];
}

//---------------

short H_Axis3(short HKey, short HInput){
return xI_Jar[ (xV_Jar[HKey]  ^ xK_Jar[HInput]) ];
}

//---------------
//---------------

short H_Axis4(short HKey, short HInput){
return xV_Jar[ (xI_Jar[HKey]  ^ xO_Jar[HInput]) ];
}

//---------------

short H_Axis5(short HKey, short HInput){
return xK_Jar[ (xV_Jar[HKey]  ^ xI_Jar[HInput]) ];
}


//--------------- Buffer //---------------



long mainBuff(char *Fin){

FILE *file;
char *name;
unsigned long fX=0, fileLen=0;
long OutLen=0;
printf("open..");
file = fopen(Fin, "rb+");
if (!file){
    printf("fOpen Failed!! ");
    return 0;
    }
printf("seek..");
fseek(file, 0, SEEK_END);
printf("tell..");
fileLen = ftell(file);
printf("seek..");
fseek(file, 0, SEEK_SET);
printf("malloc..");
buffer = (char *)malloc(fileLen+1);
if (!buffer){
    printf("Mem Failed!!");
    fclose(file);
    return 0;
    }
printf("read..");
fread(buffer, fileLen, 1, file);
printf("close..");
fclose(file);
OutLen = (long) fileLen;
l_KeepVal = OutLen;
printf("-%i- ",(int) OutLen);
return OutLen;
}

//---------------//---------------//---------------
//---------------

void ModXToHex(int ValM){
int V=ValM;
int BV=16;
int DivVal=0;
if (ValM>=ValMax){ printf("OverSize Input Error! [%i]",ValM);}
while (V>=BV){ V-=BV; DivVal++;}
XB1 =  DivVal+1;
XB2 =  V+1;
}

//---------------

void HashiFOut(char Fstr[]){
int iFO=0;
int iHsh=0;
short iFX=0;
short xCount=0;
char c;
FILE *fout;
if((fout=fopen(Fstr,"w"))==NULL){
    perror("fopen fileoUT");
    exit(0);
    }
for (iFO=0;iFO<NumBase;iFO++){
    iFX = Out_Lx[iFO];
    ModXToHex(iFX);
    iHsh++;
    XHash[iHsh] = iToHex[XB1];
    iHsh++;
    XHash[iHsh] = iToHex[XB2];
    iHsh++;
    XHash[iHsh] = ' ';
    xCount++;
    if (xCount==16){
        iHsh++;
        XHash[iHsh] = '\n';
        xCount=0;
        }
    }
fwrite(&XHash[1], iHsh, 1, fout);
printf("\n%s\n", &XHash[1]);
fclose(fout);
}

//---------------

void AddFPadding(int FPx){
int iAP=0;
if (FPx==NumBase) return 0;
//Out_Lx[iAP] = 0;
for (iAP=FPx;iAP<NumBase;iAP++) Out_Lx[iAP] = iAP;
}

//---------------

long HashiBR(long FXR, long FXEnd){
int TestVal=1, Lp=0;
long FXR2 = FXR, FXEnd2= FXEnd;
while(TestVal){
    Out_Lx[Lp] = (int) buffer[FXR2];
    Lp++;
    FXR2++;
    TestVal = (Lp<BlockMax) && (FXR2<FXEnd2);
    }
s_KeepVal = Lp-1;
if (FXR2==FXEnd2){
    AddFPadding(Lp);
    }
return FXR2;
}

//---------------
int TestJARSHIFT(short x_Jar[], int Xi){
short b_Block[BlockMax];
int i=0, Yi=0;
for(i=0;i<Xi;i++){
    Out_Lx[i]=x_Jar[Out_Lx[i]];
    b_Block[i] = Out_Lx[i] & ShiftBits;
    Out_Lx[i]-=b_Block[i];
    }
for (i=Xi;i<BlockMax;i++){
    Out_Lx[i]=x_Jar[Out_Lx[i]];
    b_Block[i] = Out_Lx[i] & ShiftBits;
    Out_Lx[i] += b_Block[Yi]-b_Block[i];
    Yi++;
    }
for(i=0;i<Xi;i++){
    Out_Lx[i]+=b_Block[Yi];
    Yi++;
    }
Out_Lx[0]-=(Yi = (Out_Lx[0] & ChopBit));
Out_Lx[0]+=Out_Lx[0]+(Yi==ChopBit);
}
//---------------
//---------------

//---------------
int TestDoubleHalfShift(short x_B[], short y_B[]){
int i=0, Xi=0, Yi=0;
for (i=0;i<BlockMax;i++){
    x_B[i]-=(Xi=(x_B[i] & ShiftBits));
    y_B[i]-=(Yi=(y_B[i] & ShiftBits));
    x_B[i]+=Yi;
    y_B[i]+=Xi;
    }
}
//---------------
//---------------

void KeyFix(short hBy_JarKF[]){
int Xii=0;
for (Xii=0;Xii<NumBase;Xii+=4){
    hBy_JarKF[Xii]=(Out_Lx[Xii] = A_Jar[Xii]);
    hBy_JarKF[Xii+1]=(Out_Lx[Xii+1] = A_Jar[Xii+1]);
    hBy_JarKF[Xii+2]=(Out_Lx[Xii+2] = A_Jar[Xii+2]);
    hBy_JarKF[Xii+3]=(Out_Lx[Xii+3] = A_Jar[Xii+3]);
    }
}

//---------------
//---------------

short HBI(short shByte, short b_Block[]){
return b_Block[ xK_Jar[ b_Duo[ shByte ] ] ];
}

//---------------


short HBII(short shByte, short b_Block[]){
return b_Block[ xI_Jar[ b_Duo[ shByte ] ] ];
}

//---------------

void CoreHashIII(short a_Block[], short b_Block[]){
short iXa, iXb, iXc, iXd;
int iiX=0;
for (iiX=0;iiX<NumBase;iiX++){

    A_Jar[xO_Jar[iiX]] = H_Axis5(
            H_Axis1( HBII(iiX + 23,     a_Block),   HBI(iiX + 11,      b_Block)  ) ^ a_Block[xI_Jar[iiX]],
                  H_Axis2( HBI(iiX + 28, b_Block),   HBII(iiX + 50,  a_Block) ) ^ b_Block[xK_Jar[iiX]]);

    }
}

//---------------
//---------------

void HashiiX(short b_Block2[]){
CoreHashIII(Out_Lx, b_Block2);
KeyFix(b_Block2);    
}

//---------------
//---------------
//---------------

void HRounds(){
//PrintKeyX(Out_Lx, "OutLX");
//PrintKeyX(Out_Fx, "OutFX");


TestJARSHIFT(xK_Jar, 1);
TestJARSHIFT(xI_Jar, 2);
TestJARSHIFT(xO_Jar, 4);
TestJARSHIFT(xV_Jar, 8);


KSched();
HashiiX(Out_Fx);

TestJARSHIFT(xK_Jar, 16);
TestJARSHIFT(xI_Jar, 32);
TestJARSHIFT(xO_Jar, 64);
TestJARSHIFT(xV_Jar, 128);

//HashiiX(Out_Fy);

//PrintKeyX(Out_Fz, "OutFZ");

KSched();
HashiiX(Out_Fz);

//PrintKeyX(Out_Fz, "OutfZ+h");
//PrintKeyX(Out_Fx, "Outfx");

TestDoubleHalfShift(Out_Fx, Out_Fz);

//PrintKeyX(Out_Fx, "Fx");
//PrintKeyX(Out_Fz, "Fz");
//printf("\n");

//KSched();
}


//---------------//        MISC      //---------------//

clock_t Tdelay(void){
clock_t time1;
time1 = clock();
return time1;
}

//---------------

void ClockedAt(char *CATstr){
timeY = Tdelay();
timeZ = timeY - timeX;
printf("\n%s ",CATstr);
printf(" [Clocked @] ");
printf("%d\n",timeZ);
timeX = timeY;
}

//---------------
//---------------

void BlockCount(){
ibM++;
if (ibM==ValMax){
    ibM=0; ibN++;
    if (ibN==ValMax){
        ibN=0; ibO++;
        if (ibO==ValMax){
            ibO=0; ibP++;
            if (ibP==ValMax){
                ibP=0; ibQ++;
                if (ibQ==ValMax){
                    ibQ=0; ibR++;
                    if (ibR==ValMax){
                        ibR=0; ibS++;
                        if (ibS==ValMax){
                            ibS=0; ibT++;
                            if (ibT==ValMax) ibT=0;
                            }
                        }
                    }
                }
            }
        }
    }
}

//---------------

void BlockMod(int iBX){
Out_Lx[BlockMax-9] = ibM;
Out_Lx[BlockMax-8] = ibN;
Out_Lx[BlockMax-7] = ibO;
Out_Lx[BlockMax-6] = ibP;
Out_Lx[BlockMax-5] = ibQ;
Out_Lx[BlockMax-4] = ibR;
Out_Lx[BlockMax-3] = ibS;
Out_Lx[BlockMax-2] = ibT;
Out_Lx[BlockMax-1] = iBX;
}

//-----------------

void XFinHash(){
HRounds();
HRounds();
}

//---------------//        MAIN++      //---------------//

int main(int argc, char *argv[]){
int i=0;
long FXLen=0, FCount=0;
int X=0, M=0;
timeX = Tdelay();
printf("\n%d\n",timeX);
InitDuo();
KGenI(2);
PrimeCell();
FXLen = mainBuff(argv[1]);
ClockedAt("Init");
while (FXLen>FCount){
    FCount = HashiBR(FCount, FXLen);
    HRounds();
    BlockCount();
    if (M<1000000) M++;
    }
AddFPadding(0);
BlockMod(s_KeepVal);
XFinHash();
HashiFOut(argv[2]);
printf("\n");
printf("\n==%i-Cycles==\n",M);
ClockedAt("Completed");
free(buffer);
return 0;
}

//---------------//

Name: Anonymous 2011-08-06 2:57

>>9,10
PIG DISGUSTING!

Name: n3n7i 2011-08-06 5:34

>>11
No 'Bravo'? =(
...perhaps its just too complicated.. =)

Think I could use this somehow for Password Auth?
Would linux let me? //think windows needs it signed or something

Name: Anonymous 2011-08-06 5:35

>>9,10
indent your phuqin code and use [code] tags, THANKS

Name: Anonymous 2011-08-06 7:07

>>12
no one cares about your shitty 600+ plus lines of C that you pasted in an unrelated thread with no formatting or comment/documentation of the algorithm. kill yourself =)

Name: n3n7i 2011-08-06 7:18

...Sooo
Any questions? =)

...It is indented init? =D

Name: Anonymous 2011-08-06 7:28

>>15
Fuck off.

Name: Anonymous 2011-08-06 7:57

//--------// DOC //-----------//??

Axis [sect] // initBDuo : 0-511 mod 256 lookup table

Jar // Building !256 Factorial Keys
      (array[0 - 255] Containing Each of 0-255 only once)

Jar-E // Key Schedule of 4 * 256Byte Jars [2 Const / 2 Vars]
          D/E/F/G_Jar (8 bit Lookup/substitution tables)

   Produces One unique Jar/run[Deterministic]
F  (G = F ->/Applied to G)
|
G  D   (F & D Consts)
 \/
  E   (E = G & D -> E)
(One applies to position/one to value)
[Last four outputs are kept for use] xK/xI/xO/xV_Jar     

...
Hashi Section is where above gets used....

Name: Anonymous 2011-08-06 8:17

I respect your opinion and find it well thought out but it's not possible and I'll tell you why.

People have not devoted their faith into SICP (SWT) and try to put faith into things that aren't meant to be. Becoming the Sussman rids greed and selfishness because everything you do is devoted to SICP (SWT). If you mess up, you break ties with MIT (SWT) and you will be punished accordingly.

There are too many Java factories in this world and that is why your idea will not work, Brother.

Name: Anonymous 2013-03-13 13:29


                __ __
      /    /   /  /_/
     /__  / __/  /

        /  .  \
       /   '   \
      /    |    \
     /           \
    /      |      \

Don't change these.
Name: Email:
Entire Thread Thread List