Visualizzazione dei risultati da 1 a 6 su 6
  1. #1
    Utente di HTML.it L'avatar di madai
    Registrato dal
    Oct 2000
    Messaggi
    421

    Convertitemi queste 2 righe di codice da C# a VB.NET

    Da C# devo convertirlo in VB.NET:

    I valori dati sono u, sgh (costanti) e k (variabile)
    u e sgh sono stringhe
    k è un intero

    codice:
    k = (uint)k ^ (uint)(sgh[i%sgh.Length])^(uint)(u[i]);
    k = k>>23|k<<9;
    Ho provato con:

    codice:
    k = k Xor Asc(Mid(sgh, i Mod sgh.Length)) Xor Asc(Mid(u, i))
    k = k >> 23 Or k << 9
    ma i risultati non corrispondono.

    Cosa ho sbagliato?
    Sviluppo web
    Cerchi un hotel a Ischia dove si mangia si beve e si fischia? Scegli ProntoIschia ed il portafoglio non rischia.

  2. #2
    Moderatore di ASP.net L'avatar di djciko
    Registrato dal
    Nov 2002
    Messaggi
    6,887
    http://www.developerfusion.co.uk/Utilities/


    codice:
    k = CType(k, System.UInt32) Xor CType((sgh(i Mod sgh.Length)), System.UInt32) Xor CType((u(i)), System.UInt32)
    k = k >> 23 Or k << 9
    se non va prenditela con loro

  3. #3
    Utente di HTML.it L'avatar di madai
    Registrato dal
    Oct 2000
    Messaggi
    421
    Grazie ma non va

    Ho fatto qualche progresso ma i risultati continuano a non essere uguali.

    Mi sto concentrando su questa riga:

    C#
    codice:
    k = (uint)k ^ (uint)(sgh[i%sgh.Length])^(uint)(u[i]);
    VB.NET
    codice:
    k = Asc(k) Xor Asc(sgh(i Mod sgh.Length)) Xor Asc(u(i))
    Sembrano dover svolgere lo stesso compito e invece i risultati non coincidono...

    Nessuno sa aiutarmi?
    Sviluppo web
    Cerchi un hotel a Ischia dove si mangia si beve e si fischia? Scegli ProntoIschia ed il portafoglio non rischia.

  4. #4
    Utente di HTML.it L'avatar di cassano
    Registrato dal
    Aug 2004
    Messaggi
    3,002
    Codice PHP:
    CType(kSystem.UInt32) Xor CType((sgh(i Mod sgh.Length)), System.UInt32) Xor CType((u(i)), System.UInt32
    >> 23 Or << 

  5. #5
    Utente di HTML.it L'avatar di madai
    Registrato dal
    Oct 2000
    Messaggi
    421
    Originariamente inviato da cassano
    Codice PHP:
    CType(kSystem.UInt32) Xor CType((sgh(i Mod sgh.Length)), System.UInt32) Xor CType((u(i)), System.UInt32
    >> 23 Or << 
    Ti ringrazio però non funziona (non è lo stesso codice postatomi da djciko?)

    Voi mi suggerite di convertire ad es. (uint)k con CType(k, System.UInt32)

    k però è una stringa e (uint) se posto davanti ad una stringa, la converte nel corrispettivo valore ASCII... per pter ottenere l'equivalente in VB utilizzo la funzione Asc().


    Altri suggerimenti?
    Sviluppo web
    Cerchi un hotel a Ischia dove si mangia si beve e si fischia? Scegli ProntoIschia ed il portafoglio non rischia.

  6. #6
    Utente di HTML.it L'avatar di madai
    Registrato dal
    Oct 2000
    Messaggi
    421
    Ho risolto

    codice:
    k = k Xor Asc(sgh(i Mod sgh.Length)) Xor Asc(u(i))

    Ciao
    Sviluppo web
    Cerchi un hotel a Ischia dove si mangia si beve e si fischia? Scegli ProntoIschia ed il portafoglio non rischia.

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 © 2026 vBulletin Solutions, Inc. All rights reserved.