1,648 questions
1
vote
1
answer
138
views
XOR encryption/decryption of Mirai
I am doing a case study on Mirai, and I am stuck on the XOR encryption/decryption. From the source code, I copied the toggle_obf function and I tried several ways to reverse the "\x22\x35" ...
1
vote
0
answers
30
views
XOR using Pre-Calculated Weights and Threshold in a Neural Network
I’m trying to implement a threshold-logic (step-activation) network in C++ that computes a 5‑input XOR function. There is no training whatsoever. I already have working code for a 3‑input XOR, but ...
1
vote
0
answers
34
views
Neural network XOR problem converging to 0.5
I'm working on coding up a neural network from scratch into js, and have implemented the following:
class Network{
constructor(layerSizes, activation){
this.activation = activation[0]
this....
2
votes
1
answer
88
views
Generalized Kronecker product with different type of product in numpy or scipy
Consider two boolean arrays
import numpy as np
A = np.asarray([[True, False],
[False, False]])
B = np.asarray([[False, True],
[True, True]])
I want to take the ...
0
votes
1
answer
71
views
z3 solver Xor issue?
Is there a potential issue with z3 solver library. Sprecifically on Xor operator?
Running the following code in python would return 'unsat' while I believe the answer should be sat. Is this a ...
1
vote
0
answers
90
views
ProVerif error : bitstring comparison and type mismatch in XOR function
I'm using ProVerif 2.05 for modeling cryptographic protocols, but I'm running into errors when performing bitwise operations with the XOR function.
The error tells me that I have a type mismatch when ...
-1
votes
1
answer
119
views
Wrong result when XOR'ing two std::bitset [closed]
#include <bitset>
#include <iostream>
int main() {
std::bitset<8> a = 10101010;
std::bitset<8> b = 11111111;
std::cout << (a ^ b);
}
When running the ...
-3
votes
1
answer
76
views
Strange behavior with lists of Python bitarrays and the in-place XOR operation ^=
I've managed to isolate (what I perceive to be) a strange relationship between lists of bitarrays and the XOR operation in Python.
Here is my minimal example:
ls = [bitarray('0'), bitarray('0')]
ls[0] ...
0
votes
1
answer
43
views
x86 opcodes for the xor instruction, cannot find detail required in manuals
Some instructions with corresponding opcodes:
xor eax, eax \x31\xc0
xor ecx, ecx \x31\xc9
xor edx, edx \x31\xd2
xor ebx, ebx \x31\xdb
Could someone please explain the calculation ...
2
votes
1
answer
108
views
Why does AMD processor use sub instruction instead of xor to verify the stack canary?
So I've been exploring the 12 chapter in the picoCTF primer and suddenly saw difference in my assembly of the program and the picoCTF's in the end of main function, where the stack canary is being ...
0
votes
1
answer
111
views
Finding maximum value of all possible subsets XOR's if the subsets can be infinitely generated
I wanted to solve this problem: C. Vampiric Powers, anyone?, Codeforces
In short, there is sequence a, and infinitely times we can find XOR of any subset and append the XOR of this subset to the end ...
2
votes
2
answers
198
views
Smallest element after xor
Starting with array of N positive integers, support Q queries. Each query contains a positive integer i. To answer the query, replace each element of the array with the result of xoring it with i, ...
-1
votes
1
answer
247
views
XOR bytes in c#
I saw a neat way to swap 2 variables using XOR lately and decided to try that in c# with strings, and though I managed to do that I'm a little worried that I have to cast int into byte after the XOR ...
3
votes
2
answers
218
views
How to XOR shapes with CSS only?
In the example below, the two XORed bars do not completely cancel out when perfectly aligned. You can see their outline.
How to make the outline disappear, which is what a correct XOR should do?
....
1
vote
1
answer
68
views
Get XOR between 2 dataframes
How to get difference between 2 pandas dataframes (symmetric difference)?
import pandas as pd
a = pd.DataFrame({'a': [1, 2], 'b': ['x', 'y']})
b = pd.DataFrame({'a': [1, 2, 3], 'b': ['x', 'z', '']})
...
0
votes
1
answer
76
views
Having trouble understanding binary scan results of XOR data frame over web socket?
I'm likely doing something very stupid and I'm having quite a bit of trouble understanding how these results could possibly be generated.
Over a web socket from a browser to a local Tcl script, the ...
1
vote
2
answers
217
views
Check if there are 3 numbers in array whose XOR is equal to zero
Given array of N real numbers x_1, x_2, ..., x_n, check if there exists 1 <= i,j,k <= n such that x_i ⊕ x_j ⊕ x_k = 0, where ⊕ is XOR operation.
This is college homework and it has to be done in ...
0
votes
0
answers
157
views
English character frequency calculation
I've written code to perform character frequency analysis on strings by taking the standard ETAOIN SRHD... frequencies of english character occurrence and I have two questions.
Is this the most ...
1
vote
5
answers
800
views
Negate every bit value of a binary in C
So I got a coding problem, the the program asks me to negate every bit of a binary, for example, the regular bitwise negation will be like this:
ten = 00001010 the negation is 11110101 = 245, well to ...
0
votes
1
answer
308
views
XOR Encryption in C with key
I am trying a simple XOR encryption in C/C++ for Windows. To achieve this I am using a key "SECRETKEY" and a character array "payload". If at some point the value of current key ...
1
vote
1
answer
118
views
How to model XOR in OWL?
In OWL I want to formulate the case where for a certain class only one or the other subclass is allowed. I want to model a restriction that allows for a property to be only linked like (A XOR B) OR (...
0
votes
1
answer
73
views
XORing all values of a (2d) numpy array together
If I have a 2d numpy array like (the data is not necessarily sequential but for example)
[[0. 1. 2. 3.]
[4. 5. 6. 7.]
[8. 9. 10. 11.]]
how can I compute 0^1^2^3^4^5^6^7^8^9^10?
I think I could ...
-3
votes
2
answers
153
views
XOR operator problems in C [closed]
Which of the following options can achieve a swapping effect for pair (*, *)? Note that ^ represents XOR operation. For binary numbers, 0 XOR 0 = 0, 0 XOR 1 = 1, 1 XOR 0 = 1, 1 XOR 1 = 0.
A. (x, y): x ...
2
votes
3
answers
180
views
XOR command fails
I am trying to create an One Time Pad for cryptography, But I am stuck in an error
The plan is
Generate Text
Generate Key
Convert text and key from Ascii to binary
Create Cipher using Key_binary XOR ...
0
votes
1
answer
116
views
Is it possible to reverse the XOR of multiple variables?
A function computes the XOR sum of binary numbers. The numbers come from a finite set of "n" constants, whose values are fixed and known (without repeats). The function is passed a subset ...
0
votes
0
answers
249
views
Can we replace XOR with multiply-add?
I'm working on a CUDA program where ALU is fully utilized (almost 100% compute throughput). The program does a lot of XOR operations, among others. Is it possible to offload the XOR to the floating-...
0
votes
1
answer
259
views
Correctly embedding and extracting Unicode data from an image
I recently asked a question about embedding data into an image. I promptly solved that issue with help from other forums. I have run into a new problem: my program works fine for all Latin characters ...
0
votes
1
answer
30
views
Execution Time Difference between two bit-wise differential execution
I found an interesting phenomenon, when I try to do symmetric encryption (Bit-wise XOR execution) for a figure with another random figure. The execution time is different between encryption and ...
3
votes
2
answers
257
views
How to Improve XORing of large uint64 arrays?
I want to xor large shifted arrays, following is portable version of that function for easy of explanation. How I can improve this computation? I have tried using AVX2 but didnt see much improvement. ...
1
vote
1
answer
80
views
Backpropagation in Neural Network for XOR data
I need to implement a Neural Network with only numpy, which gets two inputs, has one hidden layer, which uses ReLU as activation function, and one ouput layer, which uses sigmoid as activation. The ...
1
vote
1
answer
616
views
XOR Cipher in Golang with custom base64encoding/decoding, small question regarding padding
the expected output of my code is "IA0aB1QMAFQVRQARFxcWAFQIFgcHBBQRWg==" however it is actually outputting <<<<<<<<<<<<<<<<<<<<<...
1
vote
1
answer
189
views
Is that true that result of decoding XORed permutation will always be unique?
I'm struggling with the LeetCode task: Decode XORed Permutation
There is an integer array perm that is a permutation of the first n
positive integers, where n is always odd.
It was encoded into ...
0
votes
1
answer
88
views
BigInteger logical operation takes more time in subsequent loops C#
I have the below console application to check the time taken for doing a specific operation with BigInteger in C#.
using System.Diagnostics;
using System.Numerics;
Stopwatch timer = new Stopwatch();
...
1
vote
0
answers
31
views
Backpropagation algorithm for an XOR logical gate with 2 inputs
I have trouble to understand what is wrong with my code, maybe I didn't understand how the backpropagation works. Can I get some hints ?
import numpy as np
import matplotlib.pyplot as plt
def sigmoide(...
-1
votes
1
answer
41
views
A matrix that incorrectly contracts to a vector during a for loop - neural networks, Python
I'm trying to write simple 2 output XOR Neural Network in Python with no hidden layers. I have weight matrix of size (3,2). Because I have two outputs when learning I'm counting two separate errors: ...
0
votes
1
answer
1k
views
Find the number of special subarray such that the bitwise XOR of first and last element is equal to XOR of all the other elements in the subarray
Given an array of integers, find the number of subarray which has length at least 3 where the bitwise XOR of first and last element in the subarray is equal to rest of the elements in the subarray. ...
-1
votes
4
answers
460
views
How to make bit wise XNOR in C
I'm having trouble writing a bitwise XNOR function with at most 7 ~ and | operators. Example: bitXnor(6, -5) = 2. How do I do this without &?
So far I have this:
int bitXnor(int x, int y) {
...
0
votes
1
answer
63
views
Zero bytes in file
I am writing a simple script encrypting files with XOR, and I noticed that if there are zero bytes in a file block, the key is present in the encrypted block in plaintext.
For me this is unacceptable, ...
0
votes
1
answer
87
views
XOR operation in Cython within a nogil context for hashing a vector with a hex
I am trying to define a hash for a sorted vector of type size_t. As part of the solution, I use an XOR operation.
cdef size_t vector_hash(const vector[size_t]& v) noexcept nogil:
""&...
4
votes
1
answer
487
views
Minimum length subarray such that it has a subsequence with an xor sum of 0
I'm stuck on this one problem from a competitive programming archive which says:
Given an array of integers A of length n, we need to find the minimum length
subarray such that it has a subsequence ...
0
votes
2
answers
161
views
Arm Assembly for RPI3 b+ why make xor on register for counter?
i was trying to make a program to blink a RPI3 b+ with Armv7 Assembly and notice that it wasn't working using this code for the delay function
delay:
b loop
loop:
add r10, r10, #1
cmp r10,...
0
votes
1
answer
568
views
How to make AES inversed mix_column in python
I'm currently using this code to make a small example of AES
mix_columns_matrix = [
[0x2, 0x3, 0x1, 0x1],
[0x1, 0x2, 0x3, 0x1],
[0x1, 0x1, 0x2, 0x3],
[0x3, 0x1, 0x1, 0x2]
]
def ...
1
vote
1
answer
102
views
constexpr Values with Addresses to Functions
I am attempting to have the address of a function be stored in a xor'ed form in memory similar to the XorStr function that is widely used for strings which just takes a string. Stores it in a semi-...
0
votes
1
answer
215
views
What is Mathematical equation for (x * a) XOR (x *b) XOR (x *c)?
The question is; how to calculate (x * a) XOR (x *b) XOR (x *c)?
Definitions are; x, a, b, c are all large hexadecimal numbers known by default.
Solutions are; to calculate x*a, x*b, x*c and then ...
1
vote
0
answers
63
views
Why the final Windows 32-bit executable not be working?
This Python code is a simple script that encrypts a shellcode using XOR with a secret key, creates a decoder stub in assembly language, assembles the decoder stub, and then compiles it into a Windows ...
-2
votes
1
answer
106
views
Why the following xor operation is resulting the wrong answer?
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> input = {2,3,4,5,4,3,7,2};
int XOR = 0;
for (auto& i : input)
{
XOR = ...
1
vote
2
answers
82
views
Image encryption IndexError: list index out of range
I am using a double strength XOR encryption to encrypt a bytearray of an image and than rewrite the array into the image file. When I use small numbers for the encryption keys this works great and the ...
2
votes
1
answer
324
views
logic gates to control 2 swiches and 2 lights
I have 2 switches that correspond to 2 lights and I would like to control them with logic gates. My problem starts when a switch is ON and the second one goes into ON as well.
In this condition, I ...
0
votes
1
answer
86
views
XOR Cipher using native C
I am practicing my C file handling knowledge by coding a program that encrypts-decrypts a file by a given path. The problem is that my program is encrypting the file but never decrypt it.
I will share ...
7
votes
1
answer
422
views
Bitwise operator XOR (^) gives different results in linux and windows
for some reason long to explain I want to do the following bitwise operations in perl:
(let's assume that 1 means true and 0 means false)
$var1="11000001";
$var2="10000101";
$y=$...