View Single Post
Old 01-05-2012   #120
Luzifer42
Apprentice
 
Join Date: Dec 2011
Posts: 3
Likes: 0
Liked 2 Times in 1 Post
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
I dont know if it is useful, but for the sake of completeness, I have reversed the hash algorithms for debug NPD headers. Interestingly, the devklic can be retreived from debug files which are not type=1 (most EDATs are not type=1, only USRDIR/EBOOT.BIN are type=1).

Pseudocode:
Code:
function byte[] nameHash(byte[] digest) {
	byte[] nameHash=new byte[16];
	for (int i = 0; i < 16; i++)
		nameHash[i] = digest[i] ^ 0xFF;
	return nameHash;
}
Code:
function byte[] headerHash(byte[] digest, int type, byte[] devklic){
	byte[] headerHash;
	if (type == 1){
		headerHash={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
	}else{
		headerHash=devklic;
	}
	for (int i = 0; i < 16; i++)
		headerHash[i] = headerHash[i] ^ digest[i] ^ 0x55;
	return headerHash;	
}
Luzifer42 is offline   Reply With Quote
Likes: (2)