473,836 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Encrypt accentued characters

Do you know about an encryption script which accepts the accentued
characters. I've found the one below (from WebExpert premade scripts),
but when you encrypt "assurément ", then reverse the process, you
retrieve "assurment" : the "é" is gone !

Here is this script (maybe you have another) in an HTML page (simply
copy/paste to see the result) :

<html>
<head>
<!-- JavaScript Couper-coller de ISN Toolbox
Copyright 1996, Infohiway Server Network. L'utilisation restreinte
est accordée (pour un usage personnel ou commercial en autant que le
code de programmation n'est pas vendu directement). De plus, cet avis
doit être présent dans un endroit quelconque de votre document HTML.
Un hyperlien vers http://www.infohiway.com sera toujours apprécié,
mais n'est nullement nécessaire. ;-) -->
<script language="JavaS cript">
<!-- Begin
/* Même si la chaîne "cs" est en ordre ASCII ci-dessous, vous pouvez la
"mélanger" si vous voulez
compliquer des tentatives de décryption. */
bs="\\ ";
cs=' !"#$%&';
cs+="'()*+,-./0123456789:;<=> ?@ABCDEFGHIJKLM NOPQRS"
+"TUVWXYZ^[_]'abcdefghijklmn opqrstuvwxyz{|} ~\t\r\n"+bs;
cm=0;
cm1=0;
cflg="";
/* Même si cet exemple has été préparé en utilisant un paradigme de 4
bits,
vous pouvez le changer pour un à 2, 3 ou 5 bits.
Par exemple, un paradigme à 2 bits ressemblerait à ceci:
four="00 01 10 11";
fourletter="a b c d";
Et le code dans les fonctions d'encryption et de décryption ci-
dessous devraient
être modifiées pour réfléter ce changement. Il y a des
commentaires aux endroits appropriés.
ATTENTION: N'utilisez pas un espace comme caractère d'impression
dans la construction de la
variable "sixletter" . Voici d'autres exemples possibles:
sixletter="A B C D E F G H "
+"I J K L M N O P ";
sixletter=". , / ' | _ ( ~ "
+"! @ ^ * - : ; ? "; */

sixteen="0000 0001 0010 0011 0100 0101 0110 0111 "
+"1000 1001 1010 1011 1100 1101 1110 1111 ";
sixletter="; . * , x ( i : "
+"_ - ^ < > ' ~ = ";

function samp(){
// En premier, prenons les 2 chaînes
ls="";
ls1="";
kwd=document.ex 1.key.value;
kwdpd=kwd;
msg=document.ex 1.ps.value;
// étendons la clé pour être assez longue pour le message
if (cflg==0){
sl=msg.length;
}
else{
sl=msg.length/2;
}
while (kwd.length<sl) {
kwd+=kwdpd;
}
document.ex1.ps .value="Je suis en train de convertir la clé et le
message...";
if (cflg!=1){
setTimeout("sam p2()",1000);
}
else{
setTimeout("dec ryp()",1000);
}
}

function samp2(){
// Maintenant, conversion des 2 chaînes en binaire
for (var i=0;i<msg.lengt h;i++){
chk=kwd.charAt( i);
cmk=cs.indexOf( chk)+32;
chm=msg.charAt( i);
cmm=cs.indexOf( chm)+32;
for (var j=7;j>-1;j--){
c=Math.pow(2,j) ;
if (cmk>=c){
cmk=cmk-c;
ls+="1";
}
else{
ls+="0";
}
if (cmm>=c){
cmm=cmm-c;
ls1+="1";
}
else{
ls1+="0";
}
}
}
document.ex1.ps .value="Je suis en train d'encrypter le message...";
setTimeout("sam p3()",1000);
}

function samp3(){
// Maintenant, on converti les bits en utilisant la clé
ls2="";
ls4="";
for (var i=0;i<ls1.lengt h;i++){
ch=ls.charAt(i) ;
ch1=ls1.charAt( i);
if (ch=="0"){
if (ch1=="0"){
ch1="1";
}
else{
ch1="0";
}
}
ls2+=ch1;
}
/* Si un paradigme de longeur différent est utilisé, changez la boucle
ci-dessous */
for (var i=0;i<ls2.lengt h;i=i+4){
ls3=ls2.substri ng(i,i+4);
y=sixteen.index Of(ls3);
ls4+=sixletter. charAt(y);
}
document.ex1.ps .value=ls4;
}

function decryp(){
// Converti le mot clé encore une fois
ls="";
for (var i=0;i<kwd.lengt h;i++){
chk=kwd.charAt( i);
cmk=cs.indexOf( chk)+32;
for (var j=7;j>-1;j--){
c=Math.pow(2,j) ;
if (cmk>=c){
cmk=cmk-c;
ls+="1";
}
else{
ls+="0";
}
}
}
document.ex1.ps .value="Je suis à décrypter le message...";
setTimeout("dec ryp1()",1000);
}

function decryp1(){
/* Ensuite, on ramène le message de 4 bits à 8 bits.
Si un paradigme de longeur différent est utilisé, changez la
boucle ci-dessous */
ls1="";
for (var i=0;i<msg.lengt h;i++){
ls3=msg.charAt( i);
y=sixletter.ind exOf(ls3);
ls1+=sixteen.su bstring(y,y+4);
}
// Ensutie on converti les bits en utilisant la clé
ls2="";
ls4="";
for (var i=0;i<ls1.lengt h;i++){
ch=ls.charAt(i) ;
ch1=ls1.charAt( i);
if (ch=="0"){
if (ch1=="0"){
ch1="1";
}
else{
ch1="0";
}
}
ls2+=ch1;
}
for (var i=0;i<ls2.lengt h;i=i+8){
ls3=ls2.substri ng(i,i+8);
y=parseInt(ls3, 2);
ls4+=cs.charAt( y-32);
}
document.ex1.ps .value=ls4;
}

// End -->
</script>
</head>
<body>
<div align="center">
<TABLE BORDER=0 WIDTH=500>
<TR><TD ALIGN=CENTER><F ONT face="Helvetica ,Arial,Geneva"> <B>Une simple
Encryption utilisant un déplacage de bit</B></FONT><HR NOSHADE></TD>
</TR>
<TR><TD><FONT face="Helvetica ,Arial,Geneva">
<FORM NAME="ex1">
<B>Premièrement : </B>Coller ou inscriver votre clé, mot-clé ou phrase-
clé ici:
<BR><INPUT TYPE="password" NAME="key" VALUE="" SIZE=84>
<P><B>Deuxièmem ent: </B>Coller ou inscriver votre message à encrypter:
<BR><TEXTAREA NAME="ps" ROWS=10 COLS=75 WRAP=VIRTUAL></TEXTAREA>
<BR><B>Troisièm ent: </B> <INPUT TYPE="button" NAME="but" VALUE="
Encrypter " onClick="cflg=0 ;samp()">
<BR><B>Quatrièm ent: </B> <INPUT TYPE="button" NAME="but1" VALUE="
Décrypter " onClick="cflg=1 ;samp()"></FORM>
<P>Ce script supporte également de multiples (récursive) encryptions
utilisant une même ou différente clé, mot-clé ou phrase-clé pour chaque
itération. Cependant, la taille du message, doublera à chaque
encryption.</FONT><HR NOSHADE></TD></TR>
</TABLE>
</div>
</body>
</html>
Nov 6 '05 #1
3 1728
JellyON wrote:
Do you know about an encryption script which accepts the accentued
characters. I've found the one below (from WebExpert premade scripts),
but when you encrypt "assurément ", then reverse the process, you
retrieve "assurment" : the "é" is gone !


One way to preserve this character is to apply escape() before encryption
and to apply unescape() after description.
JW
Nov 6 '05 #2
Janwillem Borleffs wrote:
One way to preserve this character is to apply escape() before
encryption and to apply unescape() after description.


Obviously, this should read:

One way to preserve this character is to apply escape() before
encryption and to apply unescape() after *decryption*.
JW
Nov 6 '05 #3
In article <43************ ***********@new s.euronet.nl>, jw@jwscripts.co m
says...
Janwillem Borleffs wrote:
One way to preserve this character is to apply escape() before
encryption and to apply unescape() after description.


Obviously, this should read:

One way to preserve this character is to apply escape() before
encryption and to apply unescape() after *decryption*.
JW


Hum, effectively. I'll try asap. Thanks Janwillem
Nov 6 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3270
by: Russ Reynolds | last post by:
SQL Server 2000: ######################################################## I run the following as a normal query from Analyzer: ######################################################## SELECT encrypt(user_password) FROM emp WHERE user_id = 1 ######################################################### I run the following query from inside a stored proc:
14
2362
by: Andrew Poulos | last post by:
I've built a javascript driven quiz. Given that client-side scripting is not secure, is there a way to "obscure" answers so that they are unavailable to the casual viewer? For example, If I have an external js answer file with this in it: quest = ; is there a way to "obscure" the value but still allow js to reveal it. What I'm looking for, I guess, is some algorithm that works like this: // Massage the answers
2
1698
by: Chris | last post by:
Has anyone got a function (or class) that will take a string and encrypt it into printable characters, then a similar function that will decrypt it again, without the need to call external programs (eg: pgp, etc)? Ideally the number of characters in the encrypted strng should not be the same as the decrypted version either. Thanks, Chris
2
9211
by: Salman | last post by:
When I run the below method with a 64 character string as input such as: sr.Encrypt("1234567890123456789012345678901234567890123456789012345678904444"); I get square boxes as my output, which means that some characters are not being mapped in the encodings. What could be the problem? Since my output is funny characters, my decrption will as a result fail since it contiains invalid characters when I do a
20
4182
by: Drebin | last post by:
It's a long story really, but the bottom line is we need to encrypt or obfuscate a clear-text 9-digit SSN/taxpayer ID into something less than 21 characters. It doesn't need to be super-secure, just something that isn't plain-text and it HAS to be as unique as the original number. It also does not need to be a symmetric algorithm - we are using this as a way to create a unique "userid" on a system to which we single-signon. So it's used...
4
1669
by: stuckish | last post by:
Im trying to encrypt a string in asp.net. Post the encrypted string thru a form. Recive the encrypted string on a classic asp page and decrypt it there. I get a error saying "Padding is invalid and cannot be removed". It works perfect on my localhost (running XP SP2) but i get that error on my Windows 2000 server. Anyone have any idea why this happens? I guess something strange is happen when i post the form. But i have checked the...
1
1543
by: JellyON | last post by:
Hi. I'm trying to use the encryption script delivered with the HTML Editor : WebExpert 6. This script doesn't allows accentued characters. Then, sometimes ago I asked for a way to modify-it and someone advised me to escape() the message before encryption, and unescape() any de- encryption result... Well, I thought it would works, but don't succeed in real :-( How would you modify the script below for accepting accentued chars ? Here...
1
4428
by: Y Store Tools | last post by:
I've just started playing with mcrypt for encryption but not sure if I'll need to write my own. Basically I don't need anything advanced for protection but want to mask the data so it's not easily deciphered....BUT, I need the encrypted data to be something that can be used as an email address (the user portion of the address, not domain). So it needs to only output standard ascii characters I can use there. Is there an easy way to...
0
1148
by: Derek Hart | last post by:
I will have security rights stored in XML data, and I just need the content of elements and/or attributes to be encrypted. When the dotnet application reads in the information, it would run a simple decryption on the data. I have one routine that does this, except is uses hexadecimal characters, so I need it to be valid characters for xml. Any routines out there to do this, encrypt and decrypt data that can be used in XML? Derek
0
9825
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9673
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10859
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10560
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10602
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6984
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4463
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.