cryptography
moving keysets.. AES DES
"Keyset_48_AES": "",
"Keyset_00_DES": "",
"Keyset_FF_DES": "",

moving keysets.. AES DES
"Keyset_48_AES": "",
"Keyset_00_DES": "",
"Keyset_FF_DES": "",
trying SCRIPTIS but debugger is flaky so VS Code got the shot once again.
error = ProxiLAB.Reader.ISO14443.SendTclCommand(0x00, 0x00, TxBuffer, RxBuffer)
if (error[0]):
print("Tcl: {0}".format(ProxiLAB.GetErrorInfo(error[0])))
PopMsg += "Tcl: {0}".format(ProxiLAB.GetErrorInfo(error[0])) + "\n"
else:
print("Tcl response: " + ''.join(["0x%02X " % x for x in RxBuffer.value]))
PopMsg += "Tcl response: " + ''.join(["0x%02X " % x for x in RxBuffer.value]) + "\n"
Tcl response: 0x6A 0x86
doing some #python tests GetCard SendCommand for ISO/IEC 14443 smartcards.
https://diglib.tugraz.at/download.php?id=5f588b91684cf&location=browse
def inventory_iso14443A(self):
"""
By sending a 0xA0 command to the EVM module, the module will carry out
the whole ISO14443 anti-collision procedure and return the tags found.
>>> Req type A (0x26)
<<< ATQA (0x04 0x00)
>>> Select all (0x93, 0x20)
<<< UID + BCC
"""
response = self.issue_evm_command(cmd='A0')
for itm in response:
iba = bytearray.fromhex(itm)
# Assume 4-byte UID + 1 byte Block Check Character (BCC)
if len(iba) != 5:
logger.warn('Encountered tag with UID of unknown length')
continue
if iba[0] ^ iba[1] ^ iba[2] ^ iba[3] ^ iba[4] != 0:
logger.warn('BCC check failed for tag')
continue
uid = itm[:8] # hex string, so each byte is two chars
logger.debug('Found tag: %s (%s) ', uid, itm[8:])
yield uid
# See https://github.com/nfc-tools/libnfc/blob/master/examples/nfc-anticol.c
compiler explorer:
https://godbolt.org/z/kANkNL
void maccess(void *p) { asm volatile("movq (%0), %%rax\n" : : "c"(p) : "rax"); }
moves quadword from mem adress into rax register
AT&T syntax?
shm_open and mmap:
quote: mmap works in multiples of the page size on your system. If you're doing this on i386/amd64 or actually most modern CPUs, this will be 4096.
In the man page of mmap on my system it says: "offset must be a multiple of the page size as returned by sysconf(_SC_PAGE_SIZE).". On some systems for historical reasons the length argument may be not a multiple of page size, but mmap will round up to a full page in that case anyway.
src/test/resources/public/input/lexer/fail01.jova
Commands:
./gradlew compileJava
./gradlew compileTestJava
./gradlew printTree -PfileName=PATH_TO_JOVA_FILE
./gradlew clean
./gradlew compileJava && ./gradlew compileTestJava && ./gradlew printTree -PfileName=PATH_TO_JOVA_FILE && ./gradlew clean
./gradlew printTree -PfileName=main/antlr/at/tugraz/ist/cc/Calc.g4
gradlew permission denied
https://www.cloudhadoop.com/gradlew-permission-denied/
src/test/resources/public/input/lexer
spdz online phase
https://bristolcrypto.blogspot.com/2016/10/what-is-spdz-part-1-mpc-circuit.html
https://bristolcrypto.blogspot.com/2016/10/what-is-spdz-part-2-circuit-evaluation.html
https://bristolcrypto.blogspot.com/2016/11/what-is-spdz-part-3-spdz-specifics.html
oblivious transfer
https://crypto.stanford.edu/pbc/notes/crypto/ot.html
(c) tug
https://www.techtarget.com/searchsecurity/definition/homomorphic-encryption
quote: "
Homomorphic encryption is the conversion of data into ciphertext that can be analyzed and worked with as if it were still in its original form.
Homomorphic encryptions allow complex mathematical operations to be performed on encrypted data without compromising the encryption. In mathematics, homomorphic describes the transformation of one data set into another while preserving relationships between elements in both sets. The term is derived from the Greek words for "same structure." Because the data in a homomorphic encryption scheme retains the same structure, identical mathematical operations -- whether they are performed on encrypted or decrypted data -- will yield equivalent results.
Homomorphic encryption is expected to play an important part in cloud computing, allowing companies to store encrypted data in a public cloud and take advantage of the cloud provider’s analytic services.
Here is a very simple example of how a homomorphic encryption scheme might work in cloud computing:
"
there is a python lib PySEAL
https://gab41.lab41.org/pyseal-homomorphic-encryption-in-a-user-friendly-python-package-e27547a0b62f
https://blog.openmined.org/build-an-homomorphic-encryption-scheme-from-scratch-with-python/
https://bit-ml.github.io/blog/post/homomorphic-encryption-toy-implementation-in-python/
Since all shares (except for one) are chosen randomly, every share is indistinguishable from a random
value and no one can learn anything about a by observing at most n − 1 shares.
Drawback of additive secret sharing is that parties can drop out and fail to provide their share.
-
For both sharing methods, holders of the secret shares can compute linear functions on their shares.
encode index of the chosen image in a bit string using one-hot encoding
XOR
Shamir secret sharing instead of additive secret sharing
t-private k-out-of-l PIR protocol
collude
tbd
Secure Multiparty Computation like Yao’s Millionaires’ Problem [Yao82]
SPDZ
http://bristolcrypto.blogspot.com/2016/10/what-is-spdz-part-1-mpc-circuit.html
A secret value x is shared amongst n parties, such that the sum of all shares are equal to x.
adding sec
sharing an input value
next:
opening a value
partially
output
directional output
MAC check protocol
coin tossing protocol
commitments
https://code.visualstudio.com/docs/remote/containers
https://code.visualstudio.com/docs/remote/containers-tutorial
g++ main.cpp -o main.out
mkdir build && cd build && cmake .. && make test
cd build && cmake .. && make test
cmake .. && make test
docker container ls --all
docker exec -it quizzical_banach /bin/bash
docker ps -a
docker start NAME
docker container ls // running
// visual studio notifies if to reopen the workspace in container...
apt list --installed
API
https://www.tensorflow.org/api_docs/python/tf/keras/datasets/boston_housing/load_data
Samples contain 13 attributes of houses at different locations around the Boston suburbs in the late 1970s. Targets are the median values of the houses at a location (in k$).
http://lib.stat.cmu.edu/datasets/boston
404×13 = 5252
y_train x_train 404 samples
y_test x_test 102 samples
x 13
y 1 target scalar
y_train, y_test: numpy arrays of shape (num_samples,)
containing the target scalars. The targets are float scalars typically between 10 and 50 that represent the home prices in k$.
found on #stackoverflow
https://stackoverflow.com/a/43259471/1650038
Create a virtual environment - conda create -n tensorflowx
conda activate tensorflowx
So then the next thing, when you launch it:
Source Activate Tensorflow
Inside the virtual environment just type:
pip install jupyter notebook
pip install pandas
Then you can launch jupyter notebook saying:
jupyter notebook
! start jupy from project folder in Documents
.py files
git init
add commit
git remote add origin <REMOTE_URL>
git push remot origin
conda jupyter tensorflow: github condjup is local xfold repo
vs code debug tensorflo: repo deepflo
docker tensorflow image: once again:
docker run -it --rm -v $(realpath ~/notebooks):/tf/notebooks -p 8888:8888 tensorflow/tensorflow:latest-jupyter
https://codeflysurf.com/2021/11/22/running-tensorflow-in-jupyter-notebook-docker/
install
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04
pull run
https://hub.docker.com/r/tensorflow/tensorflow/
docker run -it --rm -v $(realpath ~/notebooks):/tf/notebooks -p 8888:8888 tensorflow/tensorflow:latest-jupyter
files in ~/notebooks
d
data analysis and vis in jupyter nb
https://jupyter.org/try
https://hub.gke2.mybinder.org/user/ipython-ipython-in-depth-9if5hwc5/notebooks/binder/Index.ipynb
import tensorflow as tf
print(tf.__version__)
# Load and prepare data, convert labels to one-hot encoding
mnist= tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test= x_train/ 255.0, x_test/ 255.0
y_train= tf.keras.utils.to_categorical(y_train, num_classes=10)
y_test= tf.keras.utils.to_categorical(y_test, num_classes=10)
# Configure the model layers
model = tf.keras.models.Sequential()
model.add(tf.keras.layers.Flatten(input_shape=(28, 28)))
model.add(tf.keras.layers.Dense(100, activation='relu'))
model.add(tf.keras.layers.Dense(50, activation='relu'))
model.add(tf.keras.layers.Dense(10, activation='softmax'))
model.summary()
# Configure the model training procedure
model.compile(optimizer=tf.keras.optimizers.SGD(lr=0.01, momentum=0.9),
loss=tf.keras.losses.CategoricalCrossentropy(from_logits=False),
metrics=['accuracy'])
model.fit(x_train, y_train, epochs=20, batch_size=64, validation_split=0.2)
model.evaluate(x_test, y_test, batch_size=64)
https://github.com/flowxcode/deepflow
https://pipenv.pypa.io/en/latest/
https://pipenv.pypa.io/en/latest/install/
$ pipenv run python main.py
$ pipenv shell
https://stackoverflow.com/a/68673872/1650038
settings.json to pipvenv in home .local
"python.pythonPath": "${env:HOME}/.local/share/virtualenvs/deepflow-eho_wYiM/bin/python"
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
//"program": "/home/linx/.local/share/virtualenvs/deepflow-eho_wYiM/<program>",
}
]
}
test x format
import tensorflow as tf
print("TensorFlow version:", tf.__version__)
https://towardsdatascience.com/a-financial-neural-network-for-quants-45ec0aaef73c
conda init
conda config --set auto_activate_base false
pip install notebook
cd /your/project/root/directory/
jupyter notebook
code left
c right
!! dont forget about requirements.txt
https://towardsdatascience.com/activation-functions-neural-networks-1cbd9f8d91d6
https://www.datacamp.com/community/tutorials/lstm-python-stock-market
quickstart:
https://flask.palletsprojects.com/en/2.0.x/quickstart/
$ export FLASK_APP=hello
$ flask run
* Running on http://127.0.0.1:5000/
https://help.pythonanywhere.com/pages/Flask/
setting up flask on pythonanywhere
bash auto complete and cycle:
bind "TAB:menu-complete"
bind "set show-all-if-ambiguous on"
bind "set menu-complete-display-prefix on"
mean median https://www.purplemath.com/modules/meanmode.htm
different projects, different requirements different envs:
create your virtual environment
python3 -m venv tutorial-env python -m venv venv $ . venv/bin/activate
https://docs.python.org/3/tutorial/venv.html
add it in your git repo, .gitignore
echo "venv" >> .gitignore
create requirements.txt:
pip freeze > requirements.txt
git add requirements.txt
pip install -r requirements.txt
https://boscacci.medium.com/why-and-how-to-make-a-requirements-txt-f329c685181e
tia
https://en.wikipedia.org/wiki/Abstract_syntax_tree
https://en.wikipedia.org/wiki/Parse_tree
citation:
For example, in a = b + c
, we evaluate the value of b
and c
, add them together, and then associate or store the result in a
. Here b
and c
have the context that we call right hand side — b
and c
are on the right hand side (of an assignment), whereas a
has left hand side context — a
is on the left hand side of an assignment. We need the value of b
and c
yet the location of a
to store the result.
A complex left hand side expression will itself also involve some right hand side evaluation. For example, a[i] = 5
requires evaluting a
and i
as values (as if right hand side) and only the array indexing itself is evalutated as left hand side (for storage location). 5
, of course, is understood as right hand side.
happy body happy mind - movement is the kay
https://www.youtube.com/watch?v=JW81H0R4Chg&ab_channel=NorthBayPython
MIN
Least Recently Used (LRU)
Least Frequently Used (LFU)
Welcome to WordPress. This is your first post. Edit or delete it, then start writing!
M | T | W | T | F | S | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Recent Comments