Visualizzazione dei risultati da 1 a 6 su 6
  1. #1
    Utente bannato
    Registrato dal
    Jan 2006
    Messaggi
    100

    [mysql] AES_ENCRYPT('','') in campo Blob

    avrei una domanda per gli esperti di mysql

    quando codifico una stringa con questo algoritmo quanto spazio va ad occupare sul database? (il doppio, lo stesso, 1000 mila volte...)

    i campi blob occupano 16kb a prescindere sia che siano pieni o vuoti?

    è possibile eseguire su un campo di questo tipo una ricerca con LIKE non case sensitive?


  2. #2
    Da: http://dev.mysql.com/doc/refman/5.0/...functions.html

    AES_ENCRYPT(str,key_str), AES_DECRYPT(crypt_str,key_str)

    These functions allow encryption and decryption of data using the official AES (Advanced Encryption Standard) algorithm, previously known as “Rijndael.” Encoding with a 128-bit key length is used, but you can extend it up to 256 bits by modifying the source. We chose 128 bits because it is much faster and it is secure enough for most purposes.

    AES_ENCRYPT() encrypts a string and returns a binary string. AES_DESCRIPT() descrypts the encrypted string and returns the original string. The input arguments may be any length. If either argument is NULL, the result of this function is also NULL.

    Because AES is a block-level algorithm, padding is used to encode uneven length strings and so the result string length may be calculated using this formula:

    16 × (trunc(string_length / 16) + 1)


    If AES_DECRYPT() detects invalid data or incorrect padding, it returns NULL. However, it is possible for AES_DECRYPT() to return a non-NULL value (possibly garbage) if the input data or the key is invalid.

    You can use the AES functions to store data in an encrypted form by modifying your queries:

    INSERT INTO t VALUES (1,AES_ENCRYPT('text','password'));

    AES_ENCRYPT() and AES_DECRYPT() can be considered the most cryptographically secure encryption functions currently available in MySQL.
    Due cose sono infinite: l'universo e la stupidità umana, ma riguardo l'universo ho ancora dei dubbi! (A.Einstein)

  3. #3
    Utente bannato
    Registrato dal
    Jan 2006
    Messaggi
    100
    si avevo visto questo nel manuale online, ma essendo abituato a sistemi di codifica che arrivano ad occupare 3 volte la dimensione della stringa originale non mi sembrava vero fosse così bello

    che mi dite del LIKE non case sensitive?

    mi sto accorgendo di un problema che non riesco a capire però :master:
    se eseguo una query da phpmyadmin ottengo un risultato corretto, invece se lo faccio eseguire via codice mi restituisce un recordset vuoto :S

  4. #4
    Calma, calma un problema alla volta (ma siamo nick-omonimi? XDXD)



    Allora:

    http://dev.mysql.com/doc/refman/5.0/...nsitivity.html

    Il manuale è di Mysql 5.0 però ^^


    Va bene questo?


    Edit: Mysql 4.1: http://dev.mysql.com/doc/refman/4.1/...nsitivity.html
    Due cose sono infinite: l'universo e la stupidità umana, ma riguardo l'universo ho ancora dei dubbi! (A.Einstein)

  5. #5
    Utente bannato
    Registrato dal
    Jan 2006
    Messaggi
    100
    si siamo omonimi ma credo che l'origine sia diversa

    cmq in quei lin spiega come forzare un LIKE in modalità case sensitive, mentre a me servirebbe fare ricerche NON case sensitive in campi blob

  6. #6
    Beh come COLLATE imposta latin1_general_ci XD

    (case insensitive)



    Dovrebbe andare, ma non ne sono sicuro.... prova ^_^
    Due cose sono infinite: l'universo e la stupidità umana, ma riguardo l'universo ho ancora dei dubbi! (A.Einstein)

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.