@Override
    public void save() throws IOException
    {
        try
        {
            MessageDigest sha = MessageDigest.getInstance("SHA-1");
            //
        }
        catch (Exception ex)
        {
            throw new IOException("Failed to rehash: "+ex.getMessage());
        }
        
        backend.position(blockOffset);
        position(0);
        
        try
        {
            byte[] emptyiv = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
            
            SecretKeySpec keyspec = new SecretKeySpec(key, "AES");
            IvParameterSpec ivspec = new IvParameterSpec(emptyiv);
            IvParameterSpec ivspec2 = new IvParameterSpec(userIV);
            
            Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
            
            cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
            for (int i = 0; i < 0x400; i += 16)
            {
                byte[] data = readBytes(16);
                data = cipher.update(data);
                backend.writeBytes(data);
            }
            
            cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec2);
            for (int i = 0x400; i < 0x7FF0; i += 16)
            {
                byte[] data = readBytes(16);
                data = cipher.update(data);
                backend.writeBytes(data);
            }
            byte[] data = readBytes(16);
            data = cipher.doFinal(data);
            backend.writeBytes(data);
        }
        catch (Exception ex)
        {
            throw new IOException("Failed to encrypt: "+ex.getMessage());
        }
    }