If you're trying to decrypt data on-chain, I recommend using a **hashing** function on your data appended to a random ethereum address for entropy. Here's how:

 1. Post hashed data inside your given `data` variable on-chain. For all intents and purposes, this data is encrypted, as nobody but you knows the hash inputs that generated this hash output. 
 2. This data is a hash made by: `web3.utils.soliditySha3([realData, randomAddress])` off-chain inside Web3js. You keep both these inputs a  secret from the blockchain.
 3. When you want to  `decrypt` this hash, post the `realData` and `randomAddress` to a smart contract. Hash them on-chain using solidity's `keccak256` function. `keccak256(abi.encodePacked(uint256 realData, address randomAddress))`. 
 4. If the on-chain hash matches the `data` variable, then this data has effectively been `decrypted`.


--------------------------------
Originally I wrote my answer using signatures but that was wrong. You **cannot** use a signature function for this (it also costs more gas anyway). For more information: https://crypto.stackexchange.com/questions/43894/asymmetry-between-public-key-and-private-key-digital-signatures-use-the-private

If you want to make sure the hash came from an authorized user, use a `mapping` object to store the hashes based on a `msg.sender` variable. `msg.sender` is effectively a signature as it is.