| [Fonctionnel] Cryptage de string par l'algorythme XOR | |
|
|
Auteur | Message |
---|
master47 Utilisateur confirmé: Rang *****
Messages : 2368 Projet Actuel :
-------------------
> PacWars
> The Perfect Pattern Studio
| Sujet: [Fonctionnel] Cryptage de string par l'algorythme XOR Ven 29 Aoû 2008 - 19:58 | |
| Bon, aprés le super script de blizter pour le cryptage de fichiers, je vous propose de crypter vos strings directement dans le jeu. Voici le script : - Citation :
var r, Str, Key, Crypted; Str = argument0 ; Key = argument1 ; r = 1 ;
Crypted = "";
for( i = 1; i <= string_length( Str); i += 1) { Crypted += chr(ord( string_char_at( Str, i)) ^ ord( string_char_at( Key, r))) ; r+=1 ; if( r > string_length( Key)) { r = 1; } } return Crypted ;
Utilisation : - Citation :
XOR_CryptString( Str, Key) Retourne la séquence string Str cryptée au moyen de la clé Key avec l'algorythme XOR
Pas besoin d'exemple pour un script aussi court, cependant si cela peut vous aider voici quand même un pti script de test : - Citation :
Crypted = XOR_CryptString( "Hello World", "voici la clé"); show_message( Crypted); UnCrypted = XOR_CryptString( Crypted, "voici la clé"); show_message( UnCrypted);
Dernière édition par master47 le Dim 5 Oct 2008 - 21:48, édité 2 fois |
|
| |
edi9999 Utilisateur confirmé: Rang *****
Messages : 2480 Localisation : France Projet Actuel : theatre flashy
| Sujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR Ven 29 Aoû 2008 - 20:05 | |
| C'est vraiment pas mal, ca peut servir pour des messages relativement courts(-de 2 pages de textes en tout) Je comprends plutot tout, mise a part le Crypted += chr(ord( string_char_at( Str, i)) ^ ord( string_char_at( Key, i - r*i))); Personnelement je comprend pas pourquoi multiplier r par i, j'aurais mis -r tout seul, enfin. Pratique :sourire: . |
|
| |
master47 Utilisateur confirmé: Rang *****
Messages : 2368 Projet Actuel :
-------------------
> PacWars
> The Perfect Pattern Studio
| Sujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR Ven 29 Aoû 2008 - 20:07 | |
| nan mais en fait la longueur de la clé est souvent plus courte que celle du string à crypter.. alors je retire n*i pour retomber au caractère 0 de la clé lorsque i dépasse sa longueur. |
|
| |
edi9999 Utilisateur confirmé: Rang *****
Messages : 2480 Localisation : France Projet Actuel : theatre flashy
| Sujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR Ven 29 Aoû 2008 - 20:10 | |
| Dans ce cas dans le if tu devrais mettre:
if( i-r*i >= string_length( Key))
a la place, sinon c'est pas que ca buggue, mais ca crypte toujours avec la meme premiere lettre. |
|
| |
nicoulas *Excellent utilisateur*
Messages : 6030 Localisation : Dordogne Projet Actuel : Croustaface Tower Defense
| Sujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR Ven 29 Aoû 2008 - 20:34 | |
| je comprend pas à quoi ça sert de crypter des strings dans le jeu ...
ah si, peut être pour charger un string crypté dans un fichier ? |
|
| |
Chlorodatafile Utilisateur confirmé: Rang *****
Messages : 2929 Localisation : Belfort Projet Actuel :
Paralights
| Sujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR Sam 30 Aoû 2008 - 7:45 | |
| j'ai pas trop compris comment on utilise des chose crypter, en plus, comment on peut les relire après ? |
|
| |
morgan Utilisateur confirmé: Rang *****
Messages : 1626 Localisation : Montpellier
| Sujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR Sam 30 Aoû 2008 - 9:55 | |
| en les décryptant |
|
| |
Invité Invité
| Sujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR Sam 30 Aoû 2008 - 14:33 | |
| |
|
| |
arthuro Utilisateur confirmé: Rang ****
Messages : 1483 Localisation : Paris Projet Actuel : Diagon https://arthursonzogni.com/Diagon
| Sujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR Mar 2 Sep 2008 - 7:17 | |
| j'ai vraiment des soucis avec se script, sa encode pas bien a des moment t'est sure qu'il n'y a aucune faute?
sauvegarde="129true0"
après cryptage-decryptage sauvegarde="129<"
et pis en modifiant un peu le code, j'obtient pas cette erreur mais sa s'arrete au saut de ligne
le truc qui bug c'est surement mes < ou / dans mon code, non? |
|
| |
master47 Utilisateur confirmé: Rang *****
Messages : 2368 Projet Actuel :
-------------------
> PacWars
> The Perfect Pattern Studio
| Sujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR Dim 5 Oct 2008 - 21:49 | |
| Veuillez m'excuser pour la lenteur de correction mais j'étais très occuppé ces derniers temps. Le script est corrigé ET fonctionnel |
|
| |
arthuro Utilisateur confirmé: Rang ****
Messages : 1483 Localisation : Paris Projet Actuel : Diagon https://arthursonzogni.com/Diagon
| Sujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR Mer 8 Oct 2008 - 16:58 | |
| |
|
| |
Contenu sponsorisé
| Sujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR | |
| |
|
| |
| [Fonctionnel] Cryptage de string par l'algorythme XOR | |
|