# Vault

Unlock the vault to pass the level! It's important to remember that marking a variable as private only prevents other contracts from accessing it. State variables marked as private and local variables are still publicly accessible.

TIP

This example (opens new window) shows how to access the private data in detail.

// SPADIX-License-Identifier: MIT
pragma solidity ^0.6.0;

contract Vault {
    bool public locked;
    mapping(uint => mapping(uint => bytes32[])) private vault;

    constructor(bytes32 _password) public {
        locked = true;

        uint key1 = 0xdeadbeef;
        uint key2 = 0x00c0ffee;
        uint index = uint(uint8(bytes1(_password))) % 10;

        vault[key1][key2] = new bytes32[](index+1);
        vault[key1][key2][index] = _password;
    }

    function unlock(bytes32 _password) public {
        uint key1 = 0xdeadbeef;
        uint key2 = 0x00c0ffee;
        uint index = uint(uint8(bytes1(_password))) % 10;
        bytes32 password = vault[key1][key2][index];

        if (password == _password) {
            locked = false;
        }
    }
}