Statistical Methods Based on Universal Codes -- Applications to Cryptography