private void revert(final StorageProvider storageProvider) {
      final var variablesStorage = storageProvider.createVariablesStorage();
      final var blockchainStorage =
          storageProvider.getStorageBySegmentIdentifier(KeyValueSegmentIdentifier.BLOCKCHAIN);
      final var blockchainUpdater = blockchainStorage.startTransaction();
      final var variablesUpdater = variablesStorage.updater();

      variablesStorage
          .getChainHead()
          .ifPresent(
              v -> {
                setBlockchainVariable(
                    blockchainUpdater, VARIABLES_PREFIX, CHAIN_HEAD_HASH.getBytes(), v);
                LOG.info("Reverted variable storage for key {}", CHAIN_HEAD_HASH);
              });

      variablesStorage
          .getFinalized()
          .ifPresent(
              v -> {
                setBlockchainVariable(
                    blockchainUpdater, VARIABLES_PREFIX, FINALIZED_BLOCK_HASH.getBytes(), v);
                LOG.info("Reverted variable storage for key {}", FINALIZED_BLOCK_HASH);
              });

      variablesStorage
          .getSafeBlock()
          .ifPresent(
              v -> {
                setBlockchainVariable(
                    blockchainUpdater, VARIABLES_PREFIX, SAFE_BLOCK_HASH.getBytes(), v);
                LOG.info("Reverted variable storage for key {}", SAFE_BLOCK_HASH);
              });

      final var forkHeads = variablesStorage.getForkHeads();
      if (!forkHeads.isEmpty()) {
        setBlockchainVariable(
            blockchainUpdater,
            VARIABLES_PREFIX,
            FORK_HEADS.getBytes(),
            RLP.encode(o -> o.writeList(forkHeads, (val, out) -> out.writeBytes(val))));
        LOG.info("Reverted variable storage for key {}", FORK_HEADS);
      }

      variablesStorage
          .getLocalEnrSeqno()
          .ifPresent(
              v -> {
                setBlockchainVariable(blockchainUpdater, Bytes.EMPTY, SEQ_NO_STORE.getBytes(), v);
                LOG.info("Reverted variable storage for key {}", SEQ_NO_STORE);
              });

      variablesUpdater.removeAll();

      variablesUpdater.commit();
      blockchainUpdater.commit();
    }
The Hash sub command for password.
app/src/main/java/org/hyperledger/besu/cli/subcommands/storage/StorageSubCommand.java