Exemple #1
0
static void forceinline Blowfish_Decrypt(_BLOWFISH_CTX *ctx, unsigned long *xl, unsigned long *xr)
{
	unsigned long Xl=*xl, Xr=*xr;
	unsigned long *p=ctx->P+16+1;
	unsigned long *s=ctx->S;
	Xl = Xl ^ *p--;
	unsigned int i;
	for (i=0;i<(16/2);i++) {
		ROUNDNOSWAP(Xl,Xr,*p--);ROUNDNOSWAP(Xr,Xl,*p--);
	};
	Xr = Xr ^ *p;
	*xl = Xr; //SWAP
	*xr = Xl; //SWAP
}
Exemple #2
0
static void forceinline Blowfish_Encrypt(_BLOWFISH_CTX *ctx, unsigned int *xl, unsigned int *xr)
{
    unsigned int Xl=*xl, Xr=*xr;
    unsigned int *p=ctx->P;
    unsigned int *s=ctx->S;
    Xl = Xl ^ *p++;
    unsigned int i;
    for (i=0; i<(16/2); i++) {
        ROUNDNOSWAP(Xl,Xr,*p++);
        ROUNDNOSWAP(Xr,Xl,*p++);
    };
    Xr = Xr ^ *p;
    *xl = Xr; //SWAP
    *xr = Xl; //SWAP
}