[Fonctionnel] Cryptage de string par l'algorythme XOR Hitskin_logo Hitskin.com

Ceci est une prévisualisation d'un thème de Hitskin.com
Installer le thèmeRetourner sur la fiche du thème



AccueilAccueil  FAQFAQ  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  ConnexionConnexion  
-14%
Le deal à ne pas rater :
Smartphone Xiaomi Redmi Note 13 Pro – 6,67″ 8 Go/256 Go, Noir
174.99 € 202.67 €
Voir le deal
-26%
Le deal à ne pas rater :
369€ PC Portable HP 15-fd0064nf – 15,6″ FHD 8 Go / 256 Go + ...
369.99 € 497.99 €
Voir le deal

 

 [Fonctionnel] Cryptage de string par l'algorythme XOR

Aller en bas 
+2
edi9999
master47
6 participants
AuteurMessage
master47
Utilisateur confirmé: Rang *****
master47


Messages : 2368
Projet Actuel :
-------------------
> PacWars
> The Perfect Pattern Studio

[Fonctionnel] Cryptage de string par l'algorythme XOR Empty
MessageSujet: [Fonctionnel] Cryptage de string par l'algorythme XOR   [Fonctionnel] Cryptage de string par l'algorythme XOR EmptyVen 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
Revenir en haut Aller en bas
http://theperfectpattern.tumblr.com
edi9999
Utilisateur confirmé: Rang *****
edi9999


Messages : 2480
Localisation : France
Projet Actuel : theatre flashy

[Fonctionnel] Cryptage de string par l'algorythme XOR Empty
MessageSujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR   [Fonctionnel] Cryptage de string par l'algorythme XOR EmptyVen 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. tord

Pratique :sourire: .
Revenir en haut Aller en bas
http://gameplay.c.la/
master47
Utilisateur confirmé: Rang *****
master47


Messages : 2368
Projet Actuel :
-------------------
> PacWars
> The Perfect Pattern Studio

[Fonctionnel] Cryptage de string par l'algorythme XOR Empty
MessageSujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR   [Fonctionnel] Cryptage de string par l'algorythme XOR EmptyVen 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.
Revenir en haut Aller en bas
http://theperfectpattern.tumblr.com
edi9999
Utilisateur confirmé: Rang *****
edi9999


Messages : 2480
Localisation : France
Projet Actuel : theatre flashy

[Fonctionnel] Cryptage de string par l'algorythme XOR Empty
MessageSujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR   [Fonctionnel] Cryptage de string par l'algorythme XOR EmptyVen 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.
Revenir en haut Aller en bas
http://gameplay.c.la/
nicoulas
*Excellent utilisateur*
nicoulas


Messages : 6030
Localisation : Dordogne
Projet Actuel : Croustaface Tower Defense [Fonctionnel] Cryptage de string par l'algorythme XOR Panicpr9

[Fonctionnel] Cryptage de string par l'algorythme XOR Empty
MessageSujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR   [Fonctionnel] Cryptage de string par l'algorythme XOR EmptyVen 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 ?
Revenir en haut Aller en bas
http://blithe.nd.free.fr/
Chlorodatafile
Utilisateur confirmé: Rang *****
Chlorodatafile


Messages : 2929
Localisation : Belfort
Projet Actuel :
Paralights

[Fonctionnel] Cryptage de string par l'algorythme XOR Empty
MessageSujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR   [Fonctionnel] Cryptage de string par l'algorythme XOR EmptySam 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 ?
Revenir en haut Aller en bas
http://chlorodatafile.tumblr.com/
morgan
Utilisateur confirmé: Rang *****
morgan


Messages : 1626
Localisation : Montpellier

[Fonctionnel] Cryptage de string par l'algorythme XOR Empty
MessageSujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR   [Fonctionnel] Cryptage de string par l'algorythme XOR EmptySam 30 Aoû 2008 - 9:55

en les décryptant super
Revenir en haut Aller en bas
Invité
Invité




[Fonctionnel] Cryptage de string par l'algorythme XOR Empty
MessageSujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR   [Fonctionnel] Cryptage de string par l'algorythme XOR EmptySam 30 Aoû 2008 - 14:33

lol...
Revenir en haut Aller en bas
arthuro
Utilisateur confirmé: Rang ****
arthuro


Messages : 1483
Localisation : Paris
Projet Actuel : Diagon https://arthursonzogni.com/Diagon

[Fonctionnel] Cryptage de string par l'algorythme XOR Empty
MessageSujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR   [Fonctionnel] Cryptage de string par l'algorythme XOR EmptyMar 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?
Revenir en haut Aller en bas
master47
Utilisateur confirmé: Rang *****
master47


Messages : 2368
Projet Actuel :
-------------------
> PacWars
> The Perfect Pattern Studio

[Fonctionnel] Cryptage de string par l'algorythme XOR Empty
MessageSujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR   [Fonctionnel] Cryptage de string par l'algorythme XOR EmptyDim 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 Wink
Revenir en haut Aller en bas
http://theperfectpattern.tumblr.com
arthuro
Utilisateur confirmé: Rang ****
arthuro


Messages : 1483
Localisation : Paris
Projet Actuel : Diagon https://arthursonzogni.com/Diagon

[Fonctionnel] Cryptage de string par l'algorythme XOR Empty
MessageSujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR   [Fonctionnel] Cryptage de string par l'algorythme XOR EmptyMer 8 Oct 2008 - 16:58

merci bien

c'est cool
Revenir en haut Aller en bas
Contenu sponsorisé





[Fonctionnel] Cryptage de string par l'algorythme XOR Empty
MessageSujet: Re: [Fonctionnel] Cryptage de string par l'algorythme XOR   [Fonctionnel] Cryptage de string par l'algorythme XOR Empty

Revenir en haut Aller en bas
 
[Fonctionnel] Cryptage de string par l'algorythme XOR
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Script de cryptage d'un fichier par XOr avec choix de la clé
» Cryptage xor
» [Cryptage] file_bin_XOR
» System de cryptage de fichier
» cryptage sténographique-ouate ?

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Forum Le CBNA :: Développement :: Scripts GML-
Sauter vers: