Skip to content

Instantly share code, notes, and snippets.

@neelratanguria
neelratanguria / nrf_decrypt.py
Created March 22, 2022 11:10
Code snippet to convert and decrypt hex output from NRF AES CTR project in python.
from Crypto.Cipher import AES
# Hex prints from debug console from segger
nrf_plain_hex = "45 78 61 6D 70 6C 65 20 73 74 72 69 6E 67 20 74 6F 20 64 65 6D 6F 6E 73 74 72 61 74 65 20 62 61 73 69 63 20 75 73 61 67 65 20 6F 66 20 41 45 53 20 43 54 52 20 6D 6F 64 65 2E"
nrf_cipher = "12 DD C3 EE DF 6E 7E 04 C7 3B DD 0D A3 F5 8E 7E CF 6D A0 A6 76 60 8A 63 01 87 A5 F6 F6 26 B6 86 3A 07 B3 C0 FE D3 E5 3E 94 95 D5 05 EA 62 E7 23 4A F8 9A 20 4C 68 B2 2C D6 E5"
# Initiat vector for aes_ctr project
iv = "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
# Method for converton of of hex string from NRF to bytes in python
def nrf_hex_str_to_bytes(m_hex_str):
const path = require('path');
const { exec } = require('child_process');
const fs = require('fs');
const rimraf = require('rimraf');
function renameOutputFolder(buildFolderPath, outputFolderPath) {
return new Promise((resolve, reject) => {
fs.rename(buildFolderPath, outputFolderPath, (err) => {
if (err) {
reject(err);
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
const renderReactDom = () => {
ReactDOM.render(
<React.StrictMode>
<App />
{
"name": "io.cordova.hellocordova",
"displayName": "HelloCordova",
"version": "1.0.0",
"description": "A sample Apache Cordova application that responds to the deviceready event.",
"main": "index.js",
"keywords": [
"ecosystem:cordova"
],
"author": "Apache Cordova Team",