In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Difference between revisions of "/tmp/nandTest.dat"

From WiiBrew
Jump to navigation Jump to search
m (Navbox)
(→‎Algorithm: seems like this function is just the normal rand function in the sdk)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
'''/tmp/nandTest.dat''' is a 25.6MB file created during the factory process to test reading and writing the NAND. It contains a specific pseudorandom pattern. The contents can be downloaded [http://static.hackmii.com/garbage.7z here].
 
'''/tmp/nandTest.dat''' is a 25.6MB file created during the factory process to test reading and writing the NAND. It contains a specific pseudorandom pattern. The contents can be downloaded [http://static.hackmii.com/garbage.7z here].
 +
 +
The program that uses this file copies the file across the NAND using [[:/dev/flash]] and copies it back, allowing bad copies to be identified.
 +
 +
This program has the side effect of overwriting most of the earlier factory remnants with this pattern, making factory analysis more difficult.
  
 
Like other contents of [[:/tmp]], it is erased on every [[boot2|boot]] and [[IOS]] reload.
 
Like other contents of [[:/tmp]], it is erased on every [[boot2|boot]] and [[IOS]] reload.
  
 
== Algorithm ==
 
== Algorithm ==
The following code is used to generate this file:
+
This file is generated by the [[SDK]] <code>rand</code> function.
 
  s32 seed = 1;
 
  s32 seed = 1;
 
  s16 rand(void) {
 
  s16 rand(void) {

Latest revision as of 04:40, 6 August 2022

/tmp/nandTest.dat is a 25.6MB file created during the factory process to test reading and writing the NAND. It contains a specific pseudorandom pattern. The contents can be downloaded here.

The program that uses this file copies the file across the NAND using /dev/flash and copies it back, allowing bad copies to be identified.

This program has the side effect of overwriting most of the earlier factory remnants with this pattern, making factory analysis more difficult.

Like other contents of /tmp, it is erased on every boot and IOS reload.

Algorithm

This file is generated by the SDK rand function.

s32 seed = 1;
s16 rand(void) {
    seed *= 0x41C64E6D;
    seed += 12345;
    return (s16) seed >> 16;
}

u8 getRandomChar(void) {
   return rand() >> 8;
}