CRYPTO NEWS

Are there any encryption schemes where more than one key give the same encryption and decryption operations?

Given an encryption scheme that takes as input a key $k$ and converts it to an encryption operation $E$ via the function $M(k) = E$, is it possible that more than one $k$ can give the same $E$?

For example, let $k$ and $k’$ be two distinct keys. Is it possible that $M(k) = M(k’) = E$. In this sense, the mapping from the ‘key space’ to the ‘encryption operation space’ is surjective.

It doesn’t seem like it would be a vulnerability or flaw me given the number of different possible encryption operators given by the scheme is large enough, and that each distinct encryption operator is mapped onto by roughly the same number of keys. For instance, let’s say the key space for a given key of length $n$ is $2^n$, but the corresponding encryption operation space is of size $2^{frac{n}{2}}$. For large values of $n$, although a given key would have many ‘collisions’ (other keys that give the same encryption operator), the protocol could still be secure.

TypeError: tokenInstance.balanceOf is not a function

It happen when use truffle test, here my contract file: pragma solidity ^0.5.0; import “./DappToken.sol”; contract DappTokenSale { address payable admin; DappToken public tokenContract; uint256 public tokenPrice; uint256 public tokensSold; event Sell(address _buyer, uint256 _amount); constructor (DappToken _tokenContract, uint256 _tokenPrice) public { admin = msg.sender; tokenContract = _tokenContract; tokenPrice = _tokenPrice; } function multiply (uint::Listen

It happen when use truffle test,

enter image description here

here my contract file:

pragma solidity ^0.5.0;   import "./DappToken.sol";   contract DappTokenSale {      address payable admin;     DappToken public tokenContract;     uint256 public tokenPrice;     uint256 public tokensSold;      event Sell(address _buyer, uint256 _amount);      constructor (DappToken _tokenContract, uint256 _tokenPrice) public {         admin = msg.sender;         tokenContract = _tokenContract;         tokenPrice = _tokenPrice;      }     function multiply (uint x, uint y) internal pure returns (uint z) {         require(y == 0 || (z = x * y) / y == x);     }      function buyTokens (uint256 _numberOfTokens) public payable {          require (msg.value == multiply(_numberOfTokens, tokenPrice));         require (tokenContract.balanceOf(address(this)) >= _numberOfTokens);         require (tokenContract.transfer(msg.sender, _numberOfTokens));           tokensSold += _numberOfTokens;         emit Sell(msg.sender, _numberOfTokens);     }         function endSale () public {              require (msg.sender == admin);             require (tokenContract.transfer(admin, tokenContract.balanceOf(address(this))));             selfdestruct(admin);         }      } 

and here my DappTokenSale js file:

var DappToken = artifacts.require('./DappToken.sol'); var DappTokenSale = artifacts.require('./DappTokenSale.sol');  contract('DappTokenSale', function(accounts) {     var tokenInstance;     var tokenSaleInstance;     var admin = accounts[0];     var buyer = accounts[1];      var tokenPrice = 1000000000000000;     var tokensAvailable = 750000;     var numberOfTokens;      //Some code i turn off for simplicity      it('end token sale', function() {         return DappTokenSale.deployed().then(function(instance){             tokenInstance = instance;             return DappTokenSale.deployed();         }).then(function(instance){             tokenSaleInstance = instance;             return tokenSaleInstance.endSale({from:buyer });         }).then(assert.fail).catch(function(error){             assert(error.message.indexOf('revert' >= 0, 'must be admin to end sale'));             return tokenSaleInstance.endSale({from: admin});         }).then(function(receipt){             return tokenInstance.balanceOf(admin); //<-- I think prolem is here but don't know how to fix it.         }).then(function(balance){             assert.equal(balance.toNumber(), 999990, 'return all unsold dapp tokens to admin')             return tokenSaleInstance.tokenPrice();         }).then(function(price) {             assert.equal(price.toNumber(), 0,'token price was reset')         });     });     });  

How I can fix this ? i don’t know which mistake i made :

Are there any encryption schemes where more than one key give the same encryption and decryption operations?

Shopping cart
There are no products in the cart!
Continue shopping
0