On the Mac platform, the "encryption" method is a simple rotating XOR . This applies to the profile and to all files ending in ".bin".

Unlike the AES format, there is no requirement for 16-byte alignment of the file. Thus the input length equals the output length for both encryption and decryption.

The initial "salt" for the XOR is binary 00X00Y0Z XOR 0xAB, where X, Y and Z are bits from the file length. X is the first bit, Y is the second bit and Z is the third bit.

For each byte in the file you XOR it with the current salt to decrypt. The salt is then updated by rotating it one bit higher and XORing it with the (encrypted) byte that was just read.

This is explained better in the very simple code below:

package com.goofans.gootool.io;
 
import com.goofans.gootool.util.Utilities;
 
import java.io.File;
import java.io.IOException;
 
/**
 * Encrypt/decrypt .bin files in XOR format (Mac).
 *
 * @author David Croft
 * @version $Revision: 227$
 */
public class MacBinFormat
{
  public static byte[] decodeFile(File file) throws IOException
  {
    byte[] inputBytes = Utilities.readFile(file);
    return decode(inputBytes);
  }
 
  private static byte[] decode(byte[] inputBytes) throws IOException
  {
    int length = inputBytes.length;
    byte[] outputBytes = new byte[length];
 
    int salt = (((length & 1) << 6) | ((length & 2) << 3) | (length & 4)) ^ 0xab;
 
    for (int i = 0; i < length; ++i) {
      byte inByte = inputBytes[i];
      outputBytes[i] = (byte) (salt ^ inByte);
 
      salt = ((salt & 0x7f) << 1 | (salt & 0x80) >> 7) ^ inByte;
    }
 
    return outputBytes;
  }
 
  public static void encodeFile(File file, byte[] inputBytes) throws IOException
  {
    byte[] bytes = encode(inputBytes);
    Utilities.writeFile(file, bytes);
  }
 
  private static byte[] encode(byte[] inputBytes) throws IOException
  {
    int length = inputBytes.length;
    byte[] outputBytes = new byte[length];
 
    int salt = (((length & 1) << 6) | ((length & 2) << 3) | (length & 4)) ^ 0xab;
 
    for (int i = 0; i < length; ++i) {
      byte inByte = inputBytes[i];
      byte newByte = (byte) (salt ^ inByte);
      outputBytes[i] = newByte;
 
      salt = ((salt & 0x7f) << 1 | (salt & 0x80) >> 7) ^ newByte;
    }
 
    return outputBytes;
  }
}

Sample encryption/decryption routines in Python are on the 2dboy forum.