Problems of cryptography as discrete optimization tasks