03-15-2012
XOR between strings
I am aware of truth table for XOR between binary values .
Out of curious in would like to know how XOR works between 2 strings which contain alphabets .
For example A ^ B
How it works internally?
Please help me to understand this
Thanks
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
like connect "summer" and "winter" to "summerwinter"?
Can anybody help me? thanks a lot. (2 Replies)
Discussion started by: fontana
2 Replies
2. Programming
Hi !
How to reset a variable to 0 after a reset value, say 10 using bitwise
XOR.
For example,
int cnt=0;
if(cnt<10)
cnt++;
else
cnt = 0;
How can we achieve this by using XOR only.
thanks, (1 Reply)
Discussion started by: mrgubbala
1 Replies
3. Shell Programming and Scripting
i have to xor two variables in ksh. how to do that?
tia,
DN2 (5 Replies)
Discussion started by: DukeNuke2
5 Replies
4. Programming
Hi,
I am trying to reverse a string using the following program utilizing the Exclusive OR bit operation:
int main() {
char str = "Quraish";
char *p = str, temp;
char *q = str + strlen(str) - 1;
while ( p != q ) {
if (*p != *q) {
*p ^= *q; *q ^= *p; *p ^= *q;... (1 Reply)
Discussion started by: royalibrahim
1 Replies
5. UNIX for Dummies Questions & Answers
Hello guys,
should be a very easy questn for you:
I need to delete strings in file1 based on the list of strings in file2.
like file2:
word1_word2_
word3_word5_
word3_word4_
word6_word7_
file1:
word1_word2_otherwords..,word3_word5_others... (7 Replies)
Discussion started by: roussine
7 Replies
6. Shell Programming and Scripting
The question is not as simple as the title... I have a file, it looks like this
<string name="string1">RZ-LED</string>
<string name="string2">2.0</string>
<string name="string2">Version 2.0</string>
<string name="string3">BP</string>
I would like to check for duplicate entries of... (11 Replies)
Discussion started by: raidzero
11 Replies
7. FAQ Submission Queue
The purpose of this article is revealing the unrevealed parts of the bitwise XOR.
As we aware, the truth table for the XOR operator is :
A B A^B
0 0 0
0 1 1
1 0 1
1 1 0
For example , 1^2 will be calculated as given below:
First the operands... (1 Reply)
Discussion started by: pandeesh
1 Replies
8. UNIX for Dummies Questions & Answers
hi,
i am new to shell programming, can u please tell me how to perform XOr operation of two strings.
i tried to do xor using ^symbol but this doesnt work.
help me with this
Thanks (12 Replies)
Discussion started by: anil_uvce
12 Replies
9. UNIX for Beginners Questions & Answers
Hello Everyone ,
Iam a newbie to shell programming and iam reaching out if anyone can help in this :-
I have two files
1) Insert.txt
2) partition_list.txt
insert.txt looks like this :-
insert into emp1 partition (partition_name)
(a1,
b2,
c4,
s6,
d8)
select
a1,
b2,
c4, (2 Replies)
Discussion started by: nubie2linux
2 Replies
LEARN ABOUT DEBIAN
digest::multihash
Digest::MultiHash(3pm) User Contributed Perl Documentation Digest::MultiHash(3pm)
NAME
Digest::MultiHash - XOR based, variable width multiplexing of hashes (a generalized Digest::SV1).
SYNOPSIS
use Digest::MultiHash;
my $d = Digest::Multihash->new(
width => 16, # bytes
hashs => ["SHA-512", "Whirlpool"], # see below for arbitrary arguments
);
$d->add($data);
print $d->hexdigest;
DESCRIPTION
This class inherits from Digest::base, and provides generalized digest multiplexing.
It will multiplex all calls to "add" to all of it's sub digest objects. Likewise, when the final digest is extracted the digests will be
extracted and then XOR'd over eachother according to "width".
"width" will default to the width of the first hash if unspecified.
"hashes" defaults to "SHA-1" for compatibility reasons.
This module is useful for generating keys from passphrases, by supplying the desired width and simply making sure there is enough data from
the combined hashes.
METHODS
See Digest for the complete API. This module inherits from Digest::base.
new This methods accepts a hash reference or an even sized list of parameters named according to the methods.
add
digest
Compute the hash by calling "digest" on all of the subhashes, splitting the result up into "width" sized chunk, and then XORing these
together.
If the result is not aligned on "width" the result will not be truncated. The shorter string will still be XOR'd with the hash, even if
this only affects part of the result.
If there are not at least "width" bytes of data in the output of the combined hashes an error is thrown.
clone
Clones the hash.
hashes
Get the array of hashes to use. Array values in this will be dereferenced before the call to "new" in Digest to allow passing of
arbitrary arguments. Blessed objects (of any class) will be used verbatim.
The list of hashes cannot be changed after construction.
width
Get/set the byte-width to use.
SEE ALSO
Digest, Digest::SV1, Digest::SHA1
perl v5.14.2 2009-10-19 Digest::MultiHash(3pm)