由买买提看人间百态

topics

全部话题 - 话题: xor
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
h*****3
发帖数: 1391
1
来自主题: JobHunting版 - probably XOR problem
喔,那我理解错了,我还以为是array里面有1个数重复3遍呢。
1)那这个xor以后,res1;
2) 比如说最后一个bit是1的话,再XOR扫描一遍最后一个bit是1的数,如果结果和前面
一次的相等,那就是1,1,1,如果不等,那有个数就找出来了。设为a
3)a xor res1,那其他2个数的差别就出来了。
4)如果是1,1,1的话,就找res1中的下个1,再repeat 2);如果res1中没1了,bit为
0的话,不就是有2个0,一个1,或者2个1,一个0吗?xor一遍该位为1的,如果为1,那
就是第一种情况,如果为0,那就是第二种情况,再xor一遍该位为0的,反正能找出一
个数出来。然后repeat 3 就可以了。
y*****m
发帖数: 723
2
来自主题: JobHunting版 - xor cipher面试题求解
要求写一个xor cipher的utility。
要求摘要:“Create a utility that will perform a simple XOR cryptographic
transform on a given set of data. The encryption key will be provided by the
binary data in an arbitrarily-sized external file. The size of the key in
bytes will dictate the "block size." The plaintext data will be given on
stdin, where the utility will then break it into block-sized sections, XOR
it against the key, and write the cypher text to stdout. After each block is
processed, the key should be ro... 阅读全帖
f*******t
发帖数: 7549
3
xor这个array中的所有数字,最后得到的结果就是要找的数
因为两个相同的数xor后等于0,所以偶数次的数在xor的过程中都被消灭了,只会剩下
唯一的出现奇数次的数。
a******3
发帖数: 113
4
来自主题: JobHunting版 - hackerrank的xor题目
https://www.hackerrank.com/challenges/xor-key
public class Solution {

static void xor(int[] ar, int number, int left, int right){
int max=0;
for(int i=left;i<=right;i++){
int temp=number^ar[i];
if(temp>max)
max=temp;
}
System.out.println(max);
}

public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int test_case = in.nextInt();
for(int i=0;i ... 阅读全帖
a******3
发帖数: 113
5
来自主题: JobHunting版 - hackerrank的xor题目
https://www.hackerrank.com/challenges/xor-key
public class Solution {

static void xor(int[] ar, int number, int left, int right){
int max=0;
for(int i=left;i<=right;i++){
int temp=number^ar[i];
if(temp>max)
max=temp;
}
System.out.println(max);
}

public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int test_case = in.nextInt();
for(int i=0;i ... 阅读全帖
a****s
发帖数: 559
6
来自主题: JobHunting版 - 问一个关于xor的题
1.先把这n个unsigned integers,每个都取位反,得到n个新的unsigned integers.
2.用原来的n个旧数生成小尾羊说的二叉树。
3.把新的n个数也放入2中二叉树。如果加入某个新数时其位置已经被某旧数占据,则该
新数取反前的旧数和占据该位置的旧数之XOR为0xFFFFFFFF,最大。
4.如果没有任何新数和旧数走到同一位置,查看旧数和新数的上一层的父节点。如果出
现某新数和某旧数有同一父节点,则该新数取反前的旧数和同父的旧数之XOR为
0xFFFFFFFE.
5.如果还没有,再往上找同父节点,以此类推。
真正在编程时,可以在插入新数时就一直保持一个有同父节点的最深的新旧数对(或多
个,有可能多解)。这样新数插入完,就有了结果,不需再用4.5.的办法向上回朔。
j**l
发帖数: 2911
7
来自主题: JobHunting版 - 谁来总结一下用XOR解决找数字题?
应该有好几个变种。
其中一个是只有一个数出现一次,其它数都出现两次。XOR的时候,出现两次的数成对
抵消
还有一个是这样的
N个自然数,范围都是闭区间[1, N-1], 只有唯一的一个数重复了一次,怎么找到这个
数?
好像运用到的定理是从0到(2^n - 1)的所有数XOR,结果为0
如果N不是2的整数次方,这道题需要padding么?
谁还能把其它的变体一一枚举出来?
y****n
发帖数: 579
8
来自主题: JobHunting版 - 谁来总结一下用XOR解决找数字题?
第二题,把N个自然数XOR一遍,再把区间[1,N-1]XOR一遍,结果就是重复的那个数字。
Tell me if I am wrong.
S**********e
发帖数: 62
9
Given an array of integers. Each number in the array repeats odd number of
times, only 1 number repeats even number of times. Find that number.
这个如何用xor做呢?
xor可以轻易找到唯一一个出现奇数次的元素。
h*****3
发帖数: 1391
10
来自主题: JobHunting版 - probably XOR problem
我糊涂了,0 xor 0 = 1; 1 xor 0 = 1;
怎么会3个0?
还有,如果3个数都一样的,也就是说有2个数的相对位置是完全pair的,那和题目中有
3个数不一样岂不是矛盾了?
t********e
发帖数: 25
11
来自主题: JobHunting版 - 问一个关于xor的题
Given n unsigned integer, output 2 integers which has the maximum result
after XOR.
s******d
发帖数: 61
12
Given an array of integers. Each number in the array repeats even number of
times, only 1 number repeats odd number of times. Find that number.
如何用xor做呢?
s******d
发帖数: 61
13
Given an array of integers. Each number in the array repeats even number of
times, only 1 number repeats odd number of times. Find that number.
如何用xor做呢?
P**l
发帖数: 3722
14
把所有数都xor了,出现偶数次的就都消掉了吧
b***e
发帖数: 383
15
用XOR好像不行,但是可以考虑用hashtable。
c****x
发帖数: 15
16
来自主题: JobHunting版 - probably XOR problem
I don't think XOR can solve it.
Linear sort like Radix sort is enough
h*****3
发帖数: 1391
17
来自主题: JobHunting版 - probably XOR problem
k是奇数应该可以吧。k是偶数 XOR 不出来。
a*******y
发帖数: 1040
18
来自主题: JobHunting版 - probably XOR problem
how is 0 xor 0 is 1?
it does not say the three number cannot be the same, only say it does not
appear twice, so maybe three times
g***s
发帖数: 3811
19
来自主题: JobHunting版 - 火柴问题
这是大学算法课的一个作业。后来发到了学校的bbs上,刚刚查了一下,居然有人放到
blog里面了。
http://blog.163.com/gditacmfeng@yeah/blog/static/13702062420100
先解决第1题
定义1:若所有火柴数异或为0,则该状态被称为利他态,用字母T表示;否则,为利己
态,用S表示。
定理1:对任何S态,存在方法,从其中取一堆中的若干根,使状态变为T态。
引理1.1 :A(i)为非副整数,i=1..n, 记c=A(1) xor A(2) xor …… xor A(n),若c>0
,则存在A(t), A(t) xor c 证明: 把c表示成二进制,记它的二进制数的最高位为第p位,则必然存在一个A(t),它
二进制的第p位也是1。(否则,若所有的A(i)的第p位都是0,c的第p位就也为0,矛盾
!)
x=a(t) xor c 的第p位将为1 xor 1,即0;
又因为c的最高位为p,所以x高于p位的值不变。所以必有x . 命题得证。
再来证定理1.
证明:
设共有n堆火柴,... 阅读全帖
g**********y
发帖数: 14569
20
来自主题: JobHunting版 - amazon问题求教
你写个程序运行一下,除非min=1, max=2^n, XOR(min..max)没什么意义
XOR(1..25) = 24
XOR(2..25) = 25
XOR(3..25) = 27
XOR(4..25) = 24
XOR(5..25) = 28
XOR(6..25) = 25
XOR(7..25) = 31
XOR(8..25) = 24
XOR(9..25) = 16
XOR(10..25) = 25
XOR(11..25) = 19
XOR(12..25) = 24
XOR(13..25) = 20
XOR(14..25) = 25
XOR(15..25) = 23
XOR(16..25) = 24
XOR(17..25) = 8
XOR(18..25) = 25
XOR(19..25) = 11
XOR(20..25) = 24
XOR(21..25) = 12
XOR(22..25) = 25
XOR(23..25) = 15
XOR(24..25) = 24
XOR(1..1) = 1
XOR(1..2) = 3
XOR(1..3) = 0
XOR(1..4) = 4... 阅读全帖
g**********y
发帖数: 14569
21
来自主题: JobHunting版 - 问一道面世题
怎么用XOR? 缺一个数,或多一个数,可以理解。但是同时缺,而且多,XOR怎么做?
Like this? or have better algorithm?
====================================================================
Let the missing number is M and the duplicate number is D.
1. Compute X = 1 XOR 2 XOR ... XOR N xor A[1] xor A[2] xor ... xor A[N]
X will be equal to M XOR D. Now find any non-zero bit B of X. It exists because X is not zero.
2. Compute two values
Y = XOR of numbers from 1 to N and elements of array A which have bit B equal 1
Z = XOR of numbers from ... 阅读全帖
S*A
发帖数: 7142
22
因为我最近在 hack 这个 Pogoplug V4 mobile。我顺便帮
你看了以下。
我从 UBoot 上面去掉了 serial cosole。这个是 dmesg。
时钟初始化是在 12 妙开始, 并不是 Linux 真正启动了 12 妙。
所以走到 systemd 启动也才 3.5 秒钟。注意其中有 USB 硬盘
访问,因为那个 rootfs 是在 USB 上面。仔细看 demsg,去掉
USB 硬盘访问,去掉 SATA 寻找硬盘,去掉 Ethernet 寻找
Link 的时间,剩下初始化应该就在 2 秒钟以内了。这个 3.5
秒钟很多时间是在和 USB storage 的东西相关。你只要
rootfs 不在 USB flash 上面,这些都可以启动的时候不做。
所以 2 秒钟启动应该是可以的,不需要特别多定制。
基本上改改 kernel config 或者启动参数就可以了。
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpuset
[ ... 阅读全帖
S*A
发帖数: 7142
23
因为我最近在 hack 这个 Pogoplug V4 mobile。我顺便帮
你看了以下。
我从 UBoot 上面去掉了 serial cosole。这个是 dmesg。
时钟初始化是在 12 妙开始, 并不是 Linux 真正启动了 12 妙。
所以走到 systemd 启动也才 3.5 秒钟。注意其中有 USB 硬盘
访问,因为那个 rootfs 是在 USB 上面。仔细看 demsg,去掉
USB 硬盘访问,去掉 SATA 寻找硬盘,去掉 Ethernet 寻找
Link 的时间,剩下初始化应该就在 2 秒钟以内了。这个 3.5
秒钟很多时间是在和 USB storage 的东西相关。你只要
rootfs 不在 USB flash 上面,这些都可以启动的时候不做。
所以 2 秒钟启动应该是可以的,不需要特别多定制。
基本上改改 kernel config 或者启动参数就可以了。
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpuset
[ ... 阅读全帖
s*******e
发帖数: 432
24
来自主题: Quant版 - 请教一个比较旧的算法题
XOR is communicative. So suppose you have x not repeated and all other
repeated then:
a1 XOR a2 ....XOR a2n+1 = x XOR (b1 XOR b1) XOR (bn XOR bn)
= x XOR 0 XOR 0 XOR 0 ....= x
r*****l
发帖数: 2859
25
来自主题: JobHunting版 - 两道algorithm电面题(update 答案)
You need to do more homework. XOR is exclusive OR.
for binary:
0 xor 0 = 1 xor 1 = 0
0 xor 1 = 1 xor 0 = 1
For any number a: a xor a = 0.
For any number a, b: a xor b xor b = a
Basically, as long as you see a variable appears even # of times in a xor
relationship, you can ignore it.
Very useful during interview.
r*****l
发帖数: 2859
26
来自主题: JobHunting版 - 两道algorithm电面题(update 答案)
You need to do more homework. XOR is exclusive OR.
for binary:
0 xor 0 = 1 xor 1 = 0
0 xor 1 = 1 xor 0 = 1
For any number a: a xor a = 0.
For any number a, b: a xor b xor b = a
Basically, as long as you see a variable appears even # of times in a xor
relationship, you can ignore it.
Very useful during interview.
c*****e
发帖数: 737
27
来自主题: JobHunting版 - 贡献几道A家intern的题
第一题用xor,因为相同的byte,假设x
x xor x xor x xor ... xor y xor x xor x ...
出来的结果就是要么x,要么0
当你一个个xor,找到第一个不为x不为0的时候,你可以停了。
具体怎么写code可以考虑考虑。

30
c*****e
发帖数: 737
28
来自主题: JobHunting版 - 贡献几道A家intern的题
第一题用xor,因为相同的byte,假设x
x xor x xor x xor ... xor y xor x xor x ...
出来的结果就是要么x,要么0
当你一个个xor,找到第一个不为x不为0的时候,你可以停了。
具体怎么写code可以考虑考虑。

30
o*o
发帖数: 5155
29
来自主题: JobHunting版 - 问一道题
use sum and bit xor:
def printDup(arr, size):
xor = 0
sum = -(1+size-2)*(size-2)/2
for i in range(size):
sum += arr[i]
xor ^= arr[i]
if (i != 0 and i != size-1):
xor ^= i
xor ^= 0
if (xor == 0):
print "x=%s y=%s" % (sum/2, sum/2)
else:
x = 0
least = xor & ~(xor-1)
for i in range(size):
if (arr[i] & least):
x ^= arr[i]
if (i != 0 and i != size-1 and i & least):
x ^= i
x ^= 0
print "x=%s y=%s" % (x, y)
t*******r
发帖数: 22634
30
我觉得我现在大概明白了。
题目里的那句 “put smallest non-negative integer that does not
appear at left/below in the same column/row”,对于最小的能满足
那句话的矩阵,就是:
0 1
1 0
而上面这个矩阵,实际上就是基本 XOR 算子。
从这个矩阵开始,可以递归构建更大的满足条件的矩阵(也可以看前面彩图)。
a a + rows(a)
a + rows(a) a
而这个递归构建的过程,实际上就是从基本 XOR 算子出发,构建
bitwise-XOR 算子的过程。
因此,从这个角度看,“递归构建” vs “bitwise-XOR 算子构建”,
其实是同一个东西的两个投射。所以那个 bitwise-XOR 算子并不是
巧合。从某个角度看,bitwise-XOR 算子是自带递归的算子
(属于“自带干粮的五毛”算子哈哈)。
俺前面犯的最最主要的错误,是混淆了基本 XOR 算子,和 bitwise-XOR
算子的区别。这两者不等价。
b**********h
发帖数: 419
31
来自主题: Programming版 - CIH源代码
究竟难在哪里?
; Win Cih Source Code
;I m not the dissembler of the code and really I don't know ;who is the
writer or dissembler . Compile or run this program ;at your own risk. Also I
m not giving any guarantee of running ;the program !!!.
;****************************************************************************
; * The Virus Program Information *
;****************************************************************************
; * *
; * Designer : CIH Source : TTIT of TATUNG in Taiwan... 阅读全帖
z*****n
发帖数: 7639
32
You need to read some reference book.
For Hamming encoding, it can be done by a set
of XOR gates in following logic:
Denote the hamming binaries h3, h2, h1 respectively,
and the data bits b4 b3 b2 b1 respectively,
we have
h1 = b1 xor b2 xor b4
h2 = b1 xor b3 xor b4
h3 = b2 xor b3 xor b4
For CRC-16, it depends on your divisor polynomial.
Generally we adopt CCITT-16 polynomial, which is
x^16 + x^12 + x^5 + 1
in this case the circuits is a combination of xor
gates and shifters. At each non-zero pol
c***g
发帖数: 472
33
来自主题: JobHunting版 - 问一个经典题目
1 xor 2 xor .... xor n xor array[1] xor array[2] xor ...xor array[n]
g**e
发帖数: 6127
34
来自主题: JobHunting版 - G家面经
XOR, O(n) time O(1) space. Similar way to find two repating numbers.
final public static void find2missingInt(int[] array) {
int xor = 0;
for(int i=0; i xor ^= array[i];

//start from 1 to n, watch the upper limit
for (int i=1; i<=array.length+2; i++)
xor ^= i;

/* Get the rightmost set bit in set_bit_no */
... 阅读全帖
f**d
发帖数: 768
35
来自主题: Neuroscience版 - eBook: From computer to brain
这是一本计算神经科学的优秀著作,全文拷贝这里(图和公式缺),有兴趣的同学可以
阅读
如需要,我可以分享PDF文件(--仅供个人学习,无商业用途)
From Computer to Brain
William W. Lytton
From Computer to Brain
Foundations of Computational Neuroscience
Springer
William W. Lytton, M.D.
Associate Professor, State University of New York, Downstato, Brooklyn, NY
Visiting Associate Professor, University of Wisconsin, Madison
Visiting Associate Professor, Polytechnic University, Brooklyn, NY
Staff Neurologist., Kings County Hospital, Brooklyn, NY
In From Computer to Brain: ... 阅读全帖
i**********b
发帖数: 77
36
来自主题: JobHunting版 - bloomberg 店面
哦。array length n,
the range of the integers in the array is n-1.
所以只有一个duplicated.
比如:
array: 1, 2, 3, 2, 4
len = 5;
range 1 - 4;
第一步:
sum = 1 ^ 2 ^ 3 ^ 4
第二步:
用sum 去 XOR array中每个一个元素
只有 2 被XOR了两次。 其他1,3,4都被XOR了一次。
bitwise XOR 有个特点。 x ^ x = 0 (一次XOR)
x ^ x ^ x = x (两次XOR)
所以上面两个步骤之后最后 sum = 2
这个题貌似很经典吧。呵呵
l****i
发帖数: 2772
37
来自主题: JobHunting版 - A家onsite,已悲剧
CS fresh PhD. 西雅图,已经接到HR电话,悲剧,攒RP,发面经。
第一轮,2个人。每个人先介绍了几分钟。给题,boggle,先让我分析怎么解决。代码
写到8个方向递归的时候,被打断,说知道我后面会怎么写了,让我先分析这个程度的
复杂度,他们有其他问题要问。最后15分钟,问了一大堆behavior,关于team work的
一类的问题,有矛盾怎么解决,team里有人不干活,team里有人和你不同意见等等,要
求给出一些以前经历的例子。
第二轮,老美白人。开始问了很多object oriented的问题。abstract class,
interface,什么情况下如何选择,inheritance VS composition等等。然后一个
coding,按行统计词频,不难,hashtable解决。 写code的中间,问了很多次复杂度,
基本上我写一行code,他会问一下这一行的复杂度。然后给了一个OOD,一个tree的结
构,计算表达式。然后又出了一题OOD,题目还没解释完,外面的第3轮人就敲门了。
第三轮,南美或者欧洲女。这一轮我很崩溃。第一轮,按层遍历二叉树。直接问我,你... 阅读全帖
y*********e
发帖数: 518
38
来自主题: JobHunting版 - Google intern 面经,回馈版面
第一个人:
1 写一个返回所有n比特格雷码的函数
函数形式 vector getGrayCode(n)
比如 getGrayCode(2), 应该返回{0,1,3,2}
===============================================
n bit 格雷码和 n bit 的 2 进制的整数是一样的,只是排列顺序不一样。所以,会有
2^n个格雷码。
格雷码同2进制数的转换关系是这样的:
二进制数 B = { b3 b2 b1 b0 }
格雷码数 G = { g3 g2 g1 g0 }
g3 = 0 XOR b3
g2 = b3 XOR b2
g1 = b2 XOR b1
g0 = b1 XOR b0
在2进制数前面补0,然后XOR每两个相邻的bit。举个例子,对于2进制数 11,前面补0
就成了011,然后 0 ^ 1 = 1, 1 ^ 1 = 0,转换成格雷码就是 10。
知道了这些,就可以开始写代码了。2进制转格雷码,C代码:
int binToGrayCode(int num, int n) {
int bitL = 0;
in
d******i
发帖数: 76
39
来自主题: JobHunting版 - 贡献几道A家intern的题
如果有带宽小的问题,那么就要结合binary search的思想。
In server 1.
XOR bytes between start and mid position,记录xor的结果,然后将start and mid
positions 这个范围传个server2.
在server2 上同对这个范围内的byte XOR
比较两个XOR的结果。
1. 相同,那么寻找mid + 1 to end 范围内的byte
2. 不同, 寻找 start to mid 范围内的byte
虽然这样double了XOR的次数,但是减少了传输的压力。
不知道这个思路是否和出题者的意图接近,请指正。
s*****d
发帖数: 21
40
来自主题: JobHunting版 - 贡献几道A家intern的题
和dafeilei的想法类似诶,Amazon发了篇论文Dynamo有提到:
Hash trees or Merkle trees
http://en.wikipedia.org/wiki/Hash_tree
==================
如果有带宽小的问题,那么就要结合binary search的思想。
In server 1.
XOR bytes between start and mid position,记录xor的结果,然后将start and mid
positions 这个范围传个server2.
在server2 上同对这个范围内的byte XOR
比较两个XOR的结果。
1. 相同,那么寻找mid + 1 to end 范围内的byte
2. 不同, 寻找 start to mid 范围内的byte
虽然这样double了XOR的次数,但是减少了传输的压力。
不知道这个思路是否和出题者的意图接近,请指正。
s******n
发帖数: 20
41
来自主题: JobHunting版 - 被基础题搞挂了
XOR有下列性质:
XOR is associative, so (x ^ y) ^ z = x ^ (y ^ z)
XOR is commutative: x ^ y = y ^ x
XOR is its own inverse: x ^ y = 0 if x = y
XOR has zero as an identity: x ^ 0 = x
所以 ans = (0-n)^(0-n)^dup = dup
s*******n
发帖数: 305
42
来自主题: JobHunting版 - 被基础题搞挂了

我理解的还不够透彻,我trace一下,i+1,好像不对。
{1,1,2,3,4} = 4;
个人觉得要理解上面所提到的, 不要去考虑下标了。
XOR有下列性质:
XOR is associative, so (x ^ y) ^ z = x ^ (y ^ z)
XOR is commutative: x ^ y = y ^ x
XOR is its own inverse: x ^ y = 0 if x = y
XOR has zero as an identity: x ^ 0 = x
所以 ans = (0-n)^(0-n)^dup = dup
h*******e
发帖数: 1377
43
来自主题: JobHunting版 - snapchat 面经
1 xor 2 xor3 xor 4....xor n n个数 xor 出的结果 xor arr[0]...arr[n-1] n-1个
数 得到了一个最后结果 这样只有一个元素在这个表达式中算了一遍,其他元素在这个
表达式中计算了两遍为0, 这样最后的结果就是这个missing 的元素。
h*******e
发帖数: 1377
44
来自主题: JobHunting版 - snapchat 面经
1 xor 2 xor3 xor 4....xor n n个数 xor 出的结果 xor arr[0]...arr[n-1] n-1个
数 得到了一个最后结果 这样只有一个元素在这个表达式中算了一遍,其他元素在这个
表达式中计算了两遍为0, 这样最后的结果就是这个missing 的元素。
x***j
发帖数: 75
45
来自主题: JobHunting版 - 请教个Amazo的题
gray code, 判断2个byte是否有一位不同。有个测试用例没通过就提交了, 因为自己太
笨,想了半天也没想明白。 想问问为什么没通过。
public static boolean isgray(byte b1, byte b2){

int n1=(int)b1;
int n2=(int)b2;

int xor=n1^n2;
int num=0;
while(xor>0){
if(xor%2==1) num++;
xor=xor/2;
}
if(num==1) return true;
return false;
}
t*******r
发帖数: 22634
46
我现在上计算机码字。。。我们先撇开题目不说,胡侃矩阵比解题
更有意思。。。
先看矩阵的最下面一行,很明显,这是一个自然数序列。这不是废话
么?题目明明白白写了:“put the smallest non-negative integer
that does not appear anywhere to the left of it”。。。
(反正自然数序列的大名词 axiom of infinity 也是递归出来的)。。。
那矩阵第二行是啥,其实我说那玩意儿也是一个自然数序列。。。
不过就是把 1 当 0 用,把 3 当 2 用,把 5 当 4 用,把人当机器
用。。。说漏嘴了。。。不过,ZFC 的 axiom of infinity 没定义
啥阿拉伯数字符号是不是(显然不是阿拉伯人的集合论)。。。
不过这里还有两条件:
(条件一):相同的 index 上,这两序列不能用相同阿拉伯符号。
(条件二):尽可能先用“数字小”的阿拉伯符号。
于是,某人就 XOR “1”(不管是集合 XOR,还是 binary XOR,
我们只看会不会抓老鼠。。。)。。。flip 最低位好像挺容易
。。。其实... 阅读全帖
t*******r
发帖数: 22634
47
我觉得 XOR 算子特性的深层原因,brainstorm 一下,可能跟下面几个有关:
(1)XOR 算子和 AND 算子是 abelian group (commutative group)
算子。在这个 ring 里面,XOR 算子相当于算术里的加法。
(2)bitwise(包括 bitwise-XOR 和 bitwise-AND),是无进位运算。
无进位运算在 recursive 构造的时候,能利用空隙里数值小的数字?
(3)综合上面两点之后,其实最最最最重要的,就是:Caylay Table
就是 99 表有木有!!!当然是 99 表的抽象代数版。。。
所以。。。其实俺没想到 XOR 算子的原因,看来是因为俺小时候 99 表
背得不熟,小学老师不够狠。。。plus 她一定 99 表背得滚瓜烂熟!!
// 哈哈,我 run 了,勿追杀,谢谢。。。
L******t
发帖数: 1985
48
You send a plaintext of your choice to receiver, who will send back you the
ciphertext. Then you got the key by plaintext XOR ciphertext.
Proof:
P xor K = C
P xor P xor K = K
==> K = P xor C
The weakness in the scheme is the encryption algorithm is reversible. And
the receiver cannot verify the authenticity of a sender.
c****n
发帖数: 21367
49
来自主题: Mathematics版 - 【求助】信息论小问题
【 以下文字转载自 EE 讨论区 】
发信人: cocoon (青虫※茧成心止), 信区: EE
标 题: 【求助】信息论小问题
发信站: BBS 未名空间站 (Wed Jan 24 14:40:59 2007), 转信
a_i b_i 都是二进制字符串,长度为n
每个a_i之间是相互独立的,每个b_i之间也是
H(a_i | b_i) > c (c is a constant)

H(a_1 XOR a_2 XOR ... XOR a_k | b_1, b_2, ... , b_k) > ?
XOR 是 bitwise XOR
多谢多谢 //thx & bow
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)