# Path: src/config.py
# DEFAULT_KEY = 'Falldog'
# 
# EXE_SRC_DIR = join(SRC_DIR, 'pyconcrete_exe')
# 
# EXT_SRC_DIR = join(SRC_DIR, 'pyconcrete_ext')
# 
# PY_SRC_DIR = join(SRC_DIR, 'pyconcrete')
# 
# SECRET_HEADER_PATH = join(EXT_SRC_DIR, 'secret_key.h')
# 
# SRC_DIR = join('src')
# 
# TEST_DIR = 'test'


import hashlib
import imp
import os
import subprocess
import sys
import sysconfig
        import unittest
from distutils.command.build import build
from distutils.command.build_ext import build_ext
from distutils.command.install import install
from distutils.core import Command, Extension, setup
from distutils.dist import Distribution
from os.path import join
from src.config import DEFAULT_KEY, EXE_SRC_DIR, EXT_SRC_DIR, PY_SRC_DIR, SECRET_HEADER_PATH, SRC_DIR, TEST_DIR
    key_val_lst = []
    for i, k in enumerate(key):
        n = ord(k) if PY2 else k
        key_val_lst.append("(0x%X ^ (0x%X - %d))" % (n, factor, i))
    key_val_code = ", ".join(key_val_lst)

    code = """
        #define SECRET_NUM 0x%X
        #define SECRET_KEY_LEN %d
        static const unsigned char* GetSecretKey()
        {
            unsigned int i = 0;
            static unsigned char key[] = {%s, 0/* terminal char */};
            static int is_encrypt = 1/*true*/;
            if( is_encrypt )
            {
                for(i = 0 ; i < SECRET_KEY_LEN ; ++i)
                {
                    key[i] = key[i] ^ (SECRET_NUM - i);
                }
                is_encrypt = 0/*false*/;
            }
            return key;
        }
    """ % (
        factor,
        len(key),
        key_val_code,
    )


# Path: src/config.py
# DEFAULT_KEY = 'Falldog'
# 
# EXE_SRC_DIR = join(SRC_DIR, 'pyconcrete_exe')
# 
# EXT_SRC_DIR = join(SRC_DIR, 'pyconcrete_ext')
# 
# PY_SRC_DIR = join(SRC_DIR, 'pyconcrete')
# 
# SECRET_HEADER_PATH = join(EXT_SRC_DIR, 'secret_key.h')
# 
# SRC_DIR = join('src')
# 
# TEST_DIR = 'test'


# Path: setup.py
import hashlib
import imp
import os
import subprocess
import sys
import sysconfig
        import unittest
from distutils.command.build import build
from distutils.command.build_ext import build_ext
from distutils.command.install import install
from distutils.core import Command, Extension, setup
from distutils.dist import Distribution
from os.path import join
from src.config import DEFAULT_KEY, EXE_SRC_DIR, EXT_SRC_DIR, PY_SRC_DIR, SECRET_HEADER_PATH, SRC_DIR, TEST_DIR

    key_val_lst = []
    for i, k in enumerate(key):
        n = ord(k) if PY2 else k
        key_val_lst.append("(0x%X ^ (0x%X - %d))" % (n, factor, i))
    key_val_code = ", ".join(key_val_lst)

    code = """
        #define SECRET_NUM 0x%X
        #define SECRET_KEY_LEN %d
        static const unsigned char* GetSecretKey()
        {
            unsigned int i = 0;
            static unsigned char key[] = {%s, 0/* terminal char */};
            static int is_encrypt = 1/*true*/;
            if( is_encrypt )
            {
                for(i = 0 ; i < SECRET_KEY_LEN ; ++i)
                {
                    key[i] = key[i] ^ (SECRET_NUM - i);
                }
                is_encrypt = 0/*false*/;
            }
            return key;
        }
    """ % (
        factor,
        len(key),
        key_val_code,
    )


    with open(SECRET_HEADER_PATH, 'w') as f: