Chapter 8 Probabilistic Programming
8.1 Bayes Rule
posterior-p(model|data) = likelihood-p(data|model) * prior-p(model) / p(data)
old_prob [P(h)/p(~h)] * strength_of_evidence [p(e|h)/p(e|~h)] = new_prob [p(h|e)/p(~h|e)]
Posterior = Likelihood * Prior / Marginal Likelihood
Likelihood P(Data|theta): Probability of the date could be generated by a model with the given parameter(s)
Prior P(theta): Probability of parameter value
Posterior P(theta|D): Credibility of the parameter value with the data taken into account.
Marginal Likelihood (Evidence): Probability of evidence
8.2 Other
http://brunaw.com/slides/SER2019/talk/pres.html#1 https://causal.app/ PyMc3 Quick Intro Prior Guide
Beaks cannot be of “negative” mean, therefore, HalfNormal is a reasonable, constrained prior.
Another option is to report just the Bayes Factor or likelihood ratio, rather than the posterior probability.
Models have a lot of parameters classical methods that use simple point estimates of the parameters don’t adequately capture uncertainty so we turn to Bayesian methods because Bayesian inference is one way of finding a large model with metadata.
The second reason we use Bayesian inference is for combining information you might have experimental data on the drug under one condition and aggregate data under another condition we can combine polls and election forecast of public opinion data from multiple poles and environmental statistics we have measurements of different quality Bayesian methods are particularly adapted tocombining information.
The third appeal of Bayesian methods and the sort of applications that I work on is that the inferences can map directly to decisions based on inferences express not its estimates and standard errors but rather as probability distributions we can take these probability distributions and pipe them directly into decision analysis for these reasons.
An advantage of recognizing that the prior distribution is a testable part of a Bayesian model is that it clarifies the role of the prior inference, and where it comes from.
Approximate Bayesian Computation
Laplace approximation: Approximate the posterior of a non-conjugate model
When one uses likelihood to get point estimates of model parameters, it’s called maximum-likelihood estimation, or MLE. If one also takes the prior into account, then it’s maximum a posteriori estimation (MAP). MLE and MAP are the same if the prior is uniform.
Beta conjugacy: Beta for prior & binomial for likelihoood implies beta for posterior. Update: beta(alpha + successes, beta + failures). Mean: alpha/(alpha + beta)
Small alpha and beta means the prior is less informative
Empirical Bayes is an approximation to more exact Bayesian methods. With a lot of data it is a very good approximation.
8.3 Doing Bayesian DA
In general, Bayesian analysis of data follows these steps:
Identify the data relevant to the research questions. What are the measurement scales of the data? Which data variables are to be predicted, and which data variables are supposed to act as predictors?
Define a descriptive model for the relevant data. The mathematical form and its parameters should be meaningful and appropriate to the theoretical purposes of the analysis.
Specify a prior distribution on the parameters. The prior must pass muster with the audience of the analysis, such as skeptical scientists.
Use Bayesian inference to re-allocate credibility across parameter values. Interpret the posterior distribution with respect to theoretically meaningful issues (assuming that the model is a reasonable description of the data; see next step).
Check that the posterior predictions mimic the data with reasonable accuracy (i.e., conduct a “posterior predictive check”). If not, then consider a different descriptive model.
8.4 Statistical Rethinking
bayesian: 1) likelihood: binomial 2) parameters of the likelihood 3) prior for each param
Data are measured and known; parameters are unknown and must be estimated from data.
Compared to MCMC, variational inference tends to be faster and easier to scale to large data
To combat under/overfitting use a regularizing prior or a scoring device like information criteria.
As you’ll see once you start using AIC and related measures, it is true that predictor variables that do improve prediction are not always statistically significant. It is also possible for variables that are statistically significant to do nothing useful for prediction.
But the prior on β is narrower and is meant to regularize. The prior β ~ Normal(0,1) says that, before seeing the data, the machine should be very skeptical of values above 2 and below −2, as a Gaussian prior with a standard deviation of 1 assigns only 5% plausibility to values above and below 2 standard deviations. Because the predictor variable x is standardized, you can interpret this as meaning that a change of 1 standard deviation in x is very unlikely to produce 2 units of change in the outcome.
metrics: dic, waic
Sampling from the posterior now and plotting the model’s predictions would help immensely with interpretation. And that’s the course I want to encourage and provide code for. In general, it’s not safe to interpret interactions without plotting them.
bayesian model: generative model (binomial number of success) + prior (eg. sample of probabilities of success from uniform)
bayesian inference: bayesian model + data
bayesian inference is conditioning on the data to learn the parameter values.
The reason that we call it posterior is because it represents the uncertainty after (that is, posterior to) having included the information in the data.
Bayesian Inference Methods: Sampling, Grid Approximation
8.5 Causality
8.5.1 General
Causality & DL Instrumental variables propensity score matching http://causalinference.gitlab.io/icwsm-tutorial/ http://causalinference.gitlab.io/dowhy/do_why_simple_example.html
8.5.2 Causality edX
Draw a complete DAG if your expert knowledge is insufficient to exclude any possible effect. Knowledge is expressed in the form of missing arrows.
Causal Markov Condition: If two vars share a cause this cause is also on the graph.
An association exists b/w A & Y if having info on A on average better allows us to predict Y.
An association for a -> y exists if the proportion of individuals with y is different given having or not having a.
A -> B -> Y: B is a mediator which blocks the association b/w A & Y when conditioning on it even though A is causal for Y.
Systematic bias: Any assoication between A & Y not causes by an effect of A on Y.
Bias due to a common cause is called confounding. We expect an association b/w two items with a commong cause.
a <- t -> y: t is a commong cause which blocks the association from a to y when conditioned upon.
Common effects ( a -> y <- b) don’t cause an association but common causes ( a <- y -> b) do.
For a -> y <- b, y is called a collider. It blocks association between a and b.
Selection bias: Conditioning on a collider introduces an association between its causes.
Bias stems from The existence of a shared cause of treatment and outcome and conditioning on a common effect of treatment and outcome. (Also conditioning on a mediator.)
Associations: 1) Cause & effect, 2) Common causes, 3) Conditioning on a common effect
Bias introduced by association by chance can be removed by increasing the sample size.
A (parent) -> B (descendant)
D(irectionally)-separation rules: Determine whether paths (which don’t need to follow arrows) are blocked or open. D-separation rules:
If there are no variables being conditioned on, a path is blocked iff two arrows on the path collide at some variable on the path.
Any path with a non-collider that has been conditioned on is blocked.
A collider that has been conditioned on doesn’t block the path.
A collider with a descendant that has been conditioned on doesn’t block the path.
The summary of these D-separation rules is that a path is blocked if, and only if, it contains a non-collider that has been conditioned on, or a collider that has not been conditioned on and has no descendant that had been conditioned on.
Two variables are d-separated if all paths between then are blocked
And two variables are marginally or unconditionally independent if they are D-separated without conditioning on all the variables. On the other hand, we say that two variables are conditionally independent, even a set variables L, if they are D-separated after conditioning on the variables L.
Faithfulness: Causal effects in opposite directions that cancel out, i.e a certain medication causes diseases in some people and prevents it in others. Rare.
All paths are blocked variables are not associated.
back door path: a path connecting A and Y without using arrows that leave from A. eg. Given L → A → Y ← L, the path A - L - Y is a back door path.
back door path criterion: We can identify the causal effect of A on Y if we have enough data to block all back door paths between them
confounder: A variable that, possibly with other variables, can block back door paths between treatment and outcome.
Change in estimate definition of confounder: A var is a confounder of the effect of a on y if adjusting for it alters the association between a and y
Conventional definition of confounder: L is a confounder of the effect of a on y if L meets 3 conditions: L is associated with a, L is associated with y conditional on a, L is not on a causal pathway from a to y.
surrogate confounder: a descendant of a cofounder.
turn on recruiter linkedin
cofounding if absolute but cofounder is relative to other variables.
If you can’t randomize then you have to rely on observational data. Methods: 1) Measure enough variables to block all backdoor paths between A & Y, 2) Alternatives to blocking back door paths (instrumental variable estimation) Here’s are a few options for 1):
Stratification (adjust for confounding): A way to adjust for a variable by only looking at a subset of it, for example only looking at people who smoke instead of all people. An alternative is to use regression to look at the effects in each subset and then pool the estimates.
Matching (adjust for confounding): Randomly match someone with a & b to ~a & b and a & ~b to ~a & ~b. Then see if there is an associating in the match subset.
G-methods: The following three methods should be used when time-varying confounders are affected by prior treatment.
Inverse Probability Weighting (adjust for confounding): Compute 1/p(a = 1 | b) and 1/p(a = 0 | b), and use these as weights in the association computation. Eliminates backdoor.
Standardization (G-formula)
G-estimation
All these confounding adjustment methods require knowledge of the true causal DAG since you need to know which paths to block.
Randomization, when possible, is the preferred approach to eliminating confounding.
Selection bias under the null is called collider stratification bias. One way it occurs is by conditioning on a collider or the child of a collider.
Case-control study: Outcome based selection design
Selection bias can occur due to eligibility criteria and loss to follow-up. The latter can occur from causes that have significance in the causal graph.
Internal validity: We say that a study has internal validity when the estimated association has a causal interpretation in the study population. That is, there is no selection bias, there is no confounding, et cetera.
External validity: We say that a study has external validity when the estimated association has a causal interpretation in another population. That is, we can transport or generalize the estimated effect to other populations.
In randomized trials, self-selection bias does not affect internal validity, but may affect external validity.
Bias under the null due to self-selection at baseline can happen in a follow up study.
Smart selection, adjustment for selection bias
Use inverse probability weighting to control for the four selection bias dags discussed: {insert dags here}
Competing events
Measurement error: True value isn’t equal to measured value.
Measurement bias: When the measure of association between a and y (measured treatment & outcome values) differs from that of a and y.
Types of measurement error:
Type 1, independent non-differential. Type 2, dependent non-differential. Type 3, independent differential. Type 4, dependent differential.
Independent non-differential error is the only type of measurement error that does not create bias under the null.
information bias
Statistical models and validation samples can be used to correct measurement error.
We can’t correctly choose methods of measurement error correction without considering the structure of the measurement error.
A causal DAG can’t eliminate bias due to confounding. A causal DAG can improve precision. A causal DAG can’t improve external validity. A causal DAG can represent sources of bias.
Time-varying treatments
treatment-confounder feedback: In its presence most methods are biased. Use G Methods.
The difference method: Run regression with E[M|A,C] which has the term beta_1 times a and E[Y|A,M,C] with the terms theta_1 times a & theta_2 times m. The direct effect is theta_1 and the indirect effect is beta_1 times theta_1.
8.5.3 Causality Coursera
The fundamental problem of causal inference: We can only observe one potential outcome for each person.
Causal effect: E(y^1) - E(y^0)


The arrow pointer that is optionally displayed by the selected ActionComponents.ACNavBarButton of a ActionComponents.ACNavBar
More...
|
| override void | OnMeasure (int widthMeasureSpec, int heightMeasureSpec) |
| | Raises the measure event. More...
|
| |
| override void | OnDraw (Canvas canvas) |
| | Raises the draw event. More...
|
| |
The arrow pointer that is optionally displayed by the selected ActionComponents.ACNavBarButton of a ActionComponents.ACNavBar
The ActionComponents.ACNavBarPointer is controlled by its parent ActionComponents.ACNavBar and should not be modified direction
| ActionComponents.ACNavBarPointer.ACNavBarPointer |
( |
Context |
context | ) |
|
| ActionComponents.ACNavBarPointer.ACNavBarPointer |
( |
Context |
context, |
|
|
Display |
display |
|
) |
| |
| ActionComponents.ACNavBarPointer.ACNavBarPointer |
( |
Context |
context, |
|
|
IAttributeSet |
attrs |
|
) |
| |
| ActionComponents.ACNavBarPointer.ACNavBarPointer |
( |
Context |
context, |
|
|
ACNavBarAppearance |
appearance |
|
) |
| |
| void ActionComponents.ACNavBarPointer.MoveTo |
( |
float |
y, |
|
|
bool |
animated |
|
) |
| |
Moves the ActionComponents.ACNavBarPointer to the location specified and optionally animates the move
- Parameters
-
| y | The y coordinate. |
| animated | If set to true animated. |
NOTE: Pointer animation is currently NOT supported on the Android OS because of performance issue.
| override void ActionComponents.ACNavBarPointer.OnDraw |
( |
Canvas |
canvas | ) |
|
|
protected |
Raises the draw event.
- Parameters
-
| override void ActionComponents.ACNavBarPointer.OnMeasure |
( |
int |
widthMeasureSpec, |
|
|
int |
heightMeasureSpec |
|
) |
| |
|
protected |
Raises the measure event.
- Parameters
-
| widthMeasureSpec | Width measure spec. |
| heightMeasureSpec | Height measure spec. |
Controlls the general appearance of the control
| int ActionComponents.ACNavBarPointer.BottomMargin |
|
getset |
Gets or sets the bottom margin.
The bottom margin.
| int ActionComponents.ACNavBarPointer.LayoutHeight |
|
getset |
Gets or sets the height of the layout.
The height of the layout.
| RelativeLayout.LayoutParams ActionComponents.ACNavBarPointer.layoutParams |
|
get |
Gets the layout parameters typecast to a RelativeLayout.LayoutParams
format
The layout parameters.
| int ActionComponents.ACNavBarPointer.LayoutWidth |
|
getset |
Gets or sets the width of the layout.
The width of the layout.
| int ActionComponents.ACNavBarPointer.LeftMargin |
|
getset |
Gets or sets the left margin.
The left margin.
| bool ActionComponents.ACNavBarPointer.moving |
|
get |
| int ActionComponents.ACNavBarPointer.RightMargin |
|
getset |
Gets or sets the right margin.
The right margin.
| int ActionComponents.ACNavBarPointer.TopMargin |
|
getset |
Gets or sets the top margin.
The top margin.


| 059:011 Khan | : |
Have you (O Muhammad SAW) not observed the hypocrites who say to their friends among the people of the Scripture who disbelieve: "(By Allah) If you are expelled, we (too) indeed will go out with you, and we shall never obey any one against you, and if you are attacked (in fight), we shall indeed help you." But Allah is Witness, that they verily, are liars. |
| 059:011 Maulana | : |
Hast thou not seen the hypocrites? They say to their brethren who disbelieve from among the People of the book: If you are expelled, we certainly will go forth with you, and we will never obey any one concerning you; and if you are fought against, we will certainly help you. And Allah bears witness that they surely are liars. |
| 059:011 Pickthal | : |
Hast thou not observed those who are hypocrites, (how) they tell their brethren who disbelieve among the People of the Scripture: If ye are driven out, we surely will go out with you, and we will never obey anyone against you, and if ye are attacked we verily will help you. And Allah beareth witness that they verily are liars. |
| 059:011 Rashad | : |
Have you noted those who are plagued with hypocrisy, and how they said to their companions in disbelief among the people of the scripture, "If you are evicted we will go out with you, and will never obey anyone who opposes you. If anyone fights you, we will fight on your side." GOD bears witness that they are liars. |
| 059:011 Sarwar | : |
Have you not seen the hypocrites who say to their disbelieving brothers among the People of the Book, "If you are driven out, we shall, also, leave the town with you and we shall never obey whoever seeks to harm you. If you are attacked, we shall help you." God testifies that they are liars. |
| 059:011 Shakir | : |
Have you not seen those who have become hypocrites? They say to those of their brethren who disbelieve from among the followers of the Book: If you are driven forth, we shall certainly go forth with you, and we will never obey any one concerning you, and if you are fought against, we will certainly help you, and Allah bears witness that they are most surely liars. |
| 059:011 Sherali | : |
Seest thou not the Hypocrites? They say to their brethren who disbelieve from among the People of the Book, 'If you are turned out of Medina, we will, surely, go out with you and we will never obey anyone against you, and if you are fought against, we will, certainly, help you. But ALLAH bears witness that, surely, they are the liars. |
| 059:011 Yusufali | : |
Hast thou not observed the Hypocrites say to their misbelieving brethren among the People of the Book? - "If ye are expelled, we too will go out with you, and we will never hearken to any one in your affair; and if ye are attacked (in fight) we will help you". But Allah is witness that they are indeed liars. |
Concepts/Themes Covered: الإيمان > الإيمان بالله > النفاق Faith> Belief In Allah> Hypocrisy الجهاد > الجهاد في سبيل الإسلام > الدعوة إلى الجهاد Jihad> The Call to Jihad>The Call for the Holy War الديانات > أهل الكتاب: ( اليهود و النصارى) > العلاقة معهم Religions> The People of the Book (the Jews and the Christians)>The Relation with them
This tool uses eight English parallel translations for the Holy Quran imported from Mr. Clay Smith. You can also visit Qurany Concepts for browsing the Quran themes or topics. If you want to search the Holy Quran for keywords, please visit Qurany Keywords.


Hey, I am
Aniket Chaurasia
Student of:
Electrical Engineering
Interested In:
Coding👨🏼💻 Gaming🎮 and Racing🏍


Human activities affect climate through emissions of gases, aerosols and changes in land surface characteristics (e.g. [ 21]) and the Intended Nationally Determined Contributions (INDCs), submitted prior to COP21, include a broad set of components beyond well-mixed GHGs. For example, some countries included measures to reduce short-lived forcers such as nitrogen oxides (NOx), carbon monoxide (CO) and black carbon (BC) aerosols. However, the words ‘greenhouse gases’ in Article 4 exclude aerosols and aerosol precursor gases (e.g. BC and SO 2) from the group of components included in the evaluation of ‘balance’. By convention, this phrase also probably implies well-mixed GHGs, excluding tropospheric and stratospheric ozone changes. In the case of methane, however, indirect short-lived GHG responses are included. That is, the tropospheric ozone chemical response is routinely included (via the global warming potential for CH 4), creating a situation where one ozone precursor's impact on climate via tropospheric ozone is accounted for, whereas all others are not. Changes in stratospheric ozone and water vapour and the climate impacts of these are also generally included for methane.
The Kyoto Protocol adopted a basket of six gases or groups of gases: CO 2, CH 4, N 2O, SF 6, perfluorocarbons (PFCs) and hydrofluorocarbons (HFCs)—and it may be argued that this is the group of gases that could by default be included in the ‘greenhouse gas balance’. (Later, NF 3 was added to the basket of ‘Kyoto II’.) The GHG chlorofluorocarbons (CFCs) and hydrochlorofluorocarbons (HCFCs) are regulated under the Montreal Protocol, and HFCs are now also likely to be regulated under the Montreal Protocol through the Kigali Amendment.


Need someone to just recommend one movie to you without having
the hassle to go through ten different streaming apps?
This recommendation system is designed to minimize the users
overthinking and contemplation.

How to use
-
Choose the genre you are in the mood for. You can also
select the preferable release date and the language.
-
We will give you 10 options, among which you have to choose
the movies which you have previously seen and liked. If you
like none of the options presented to you, you can ask for
another set of options by pressing the refresh button.
-
That's it! You will get one movie which you will definitely
like based on your previously likings.
-
Don't like the movie we suggested or have already seen it?
You can ask us for another recommendation by pressing the
pass button.


This class provides a text editor specialized for editing
C files.
It is invoked automatically when opening any file with the
.c
extension
in its name.
The EditC class is derived from the
EditProgram class, and
therefore inherits all of its features.
Compile
and Compile and Load
.
The Compile
choice brings up the Monitor widget which
will run make
and compile the current file.
The Compile and Load
menu choice
will compile the current file and load it back
into Tycho by using the Tcl load
command. The Compile and Load
menu choice can be used
to create new Tcl commands that are written in C.
Note that it is risky to test C code within Tycho, since failure
of the C code could cause Tycho to crash.
When a C file is compiled and loaded, the following steps occur.
load
command is to work on a particular
file, then there must be a Tcl initialization procedure in the C file
(see below for details). The Add Tcl Initialization
choice under the Special
menu will add an initialization
procedure.
Since Tycho can't know what commands you want to register, the initialization procedure will have a body that must be modified by the user.
makefile
Makefile
.mk
extension. For example, if the file being
is named myTclCommands.c
, then we look for
myTclCommands.mk
make
command is executed with the makefile
determined from the step above. Continuing our example above, the
command would be make -f myTclCommand.mk
.
load
command is called. The
load
command is passed the architecture dependent shared
object filename.
.mk
extension.
The template that is used is located at $TYCHO/editors/textedit/templates/Cmakefile.mk
.
The template includes two makefiles: $TYCHO/obj.$PTARCH/java.mk
and $TYCHO/obj.$PTARCH/tcl.mk
These two makefiles are generated by running configure
.
The Tcl extensions use these file as well, see
$TYCHO/doc/coding/buildtclexts.html
for details.
If these two makefiles are not present, then make
config_tclexts
is called while in the $TYCHO
directory.
load
command invokes an initialization procedure
after loading the shared object. The name of the initialization
procedure depends on the file name of the shared object, or on the Tcl
package name. See the Tcl load
command for the details, but if the shared object is named myTclCommand.so
, then the initialization procedure would be
int Mytclcommand_InitProc(Tcl_Interp *interp)Usually the initialization procedure registers commands, for example
int Mytclcommand_InitProc(Tcl_Interp *interp) { Tcl_CreateCommand (interp, "mytclcommand", Tcl_MyTclCommandCmd, (ClientData) infoPtr, (Tcl_CmdDeleteProc*) NULL); return TCL_OK; }


Before Change
from setuptools.command.test import test as TestCommand
if "PYTHONPATH" in os.environ.keys():
here = os.environ["PYTHONPATH"].split(os.pathsep)[-1]
else:
here = os.path.abspath(os.path.dirname(__file__))
After Change
from setuptools.command.test import test as TestCommand
try:
here = os.environ["PYTHONPATH"].split(os.pathsep)[-1]
except KeyError:
here = os.path.abspath(os.path.dirname(__file__))
// Get the long description from the README file
try:
with open(os.path.join(here, "docs", "source", "index.rst"),
encoding="utf-8") as f:
long_description = f.read()


BEYPORE BEACH
Located at the mouth of the Chaliyar River, 10 km from Kozhikode, Beypore Beach is famous for its Ship building yard more than 1500 years old. During the trading days of Arabs and Chinese, and later the Europeans, this was one of the most important fishing harbours


https://leetcode.com/problems/trapping-rain-water/
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain water (blue section) are being trapped. Thanks Marcos for contributing this image! Example: Input: [0,1,0,2,1,0,1,3,2,1,2,1] Output: 6
class Solution { public: int trap(vector& height) {
class Solution { public: int trap(vector& height) { int sum1 = 0; for (int i = 0; i < height.size(); i ++) sum1 += height[i]; int l = 0; int h = height.size() - 1; int lmax = 0; int hmax = 0; while (h > l){ if (height[l] > lmax) lmax = height[l]; else height[l] = lmax; if (height[h] > hmax) hmax = height[h]; else height[h] = hmax; if (lmax < hmax) l++; else h--; } int sum2 = 0; for (int i = 0; i < height.size(); i ++) sum2 += height[i]; return sum2 - sum1; } };


Seattle
Visit us at:
Example.com
Box 564, Disneyland
USA
Tokyo
Visit us at:
Example.com
Box 564, Disneyland
Tokyo
Dubai
Visit us at:
Example.com
Box 564, Disneyland
Dubai
Paris
Visit us at:
Example.com
Box 564, Disneyland
Paris
Lima
Visit us at:
Example.com
Box 564, Disneyland
Lima
Cookies Sold
Responsive Contact Section
Resize the browser window to see the effect.
Contact Us
Swing by for a cup of coffee, or leave us a message:


You are 5 seconds away from activating your private account
Thank you for confirming your email address.
You will be redirect to the home page in 6 seconds


|
CryptoAuthLib
Atmel CryptoAuthentication Library
|
These methods provide the most convenient, simple API to CryptoAuth chips. More...
Data Structures | |
| struct | atca_sha256_ctx |
Macros | |
| #define | atcab_bin2hex |
Typedefs | |
| typedef struct atca_sha256_ctx | atca_sha256_ctx_t |
Functions | |
| ATCA_STATUS | atcab_version (char *verstr) |
| returns a version string for the CryptoAuthLib release. The format of the version string returned is "yyyymmdd" More... | |
| ATCA_STATUS | atcab_init (ATCAIfaceCfg *cfg) |
| atcab_init is called once for the life of the application and creates a global ATCADevice object used by Basic API. This method builds a global ATCADevice instance behinds the scenes that's used for all Basic API operations More... | |
| ATCA_STATUS | atcab_init_device (ATCADevice cadevice) |
| atcab_init_device can be used to initialize the global ATCADevice object to point to one of your choosing for use with all the atcab_ basic API. More... | |
| ATCA_STATUS | atcab_release (void) |
| release (free) the global ATCADevice instance. This must be called in order to release or free up the interface. More... | |
| ATCADevice | atcab_getDevice (void) |
| a way to get the global device object. Generally for more sophisticated users of atca More... | |
| ATCA_STATUS | atcab_wakeup (void) |
| wakeup the CryptoAuth device More... | |
| ATCA_STATUS | atcab_idle (void) |
| idle the CryptoAuth device More... | |
| ATCA_STATUS | atcab_sleep (void) |
| invoke sleep on the CryptoAuth device More... | |
| ATCA_STATUS | atcab_cfg_discover (ATCAIfaceCfg cfgArray[], int max) |
| ATCA_STATUS | atcab_info (uint8_t *revision) |
| get the device revision information More... | |
| ATCA_STATUS | atcab_challenge (const uint8_t *challenge) |
| send a challenge to the device (a pass-through nonce) More... | |
| ATCA_STATUS | atcab_challenge_seed_update (const uint8_t *seed, uint8_t *rand_out) |
| send a challenge to the device (a seed update nonce) More... | |
| ATCA_STATUS | atcab_nonce_base (uint8_t mode, const uint8_t *num_in, uint8_t *rand_out) |
| send a challenge to the device (a non-seed update nonce) More... | |
| ATCA_STATUS | atcab_nonce (const uint8_t *tempkey) |
| Execute a pass-through Nonce command to initialize TempKey to the specified value. More... | |
| ATCA_STATUS | atcab_nonce_rand (const uint8_t *seed, uint8_t *rand_out) |
| Initialize TempKey with a random Nonce. More... | |
| ATCA_STATUS | atcab_random (uint8_t *rand_out) |
| Get a 32 byte random number from the CryptoAuth device. More... | |
| ATCA_STATUS | atcab_is_locked (uint8_t zone, bool *lock_state) |
| Query to see if the specified zone is locked. More... | |
| ATCA_STATUS | atcab_is_slot_locked (uint8_t slot, bool *lock_state) |
| Query to see if the specified slot is locked. More... | |
| ATCA_STATUS | atcab_get_addr (uint8_t zone, uint16_t slot, uint8_t block, uint8_t offset, uint16_t *addr) |
| Compute the address given the zone, slot, block, and offset. More... | |
| ATCA_STATUS | atcab_get_zone_size (uint8_t zone, uint16_t slot, size_t *size) |
| Gets the size of the specified zone in bytes. More... | |
| ATCA_STATUS | atcab_read_zone (uint8_t zone, uint16_t slot, uint8_t block, uint8_t offset, uint8_t *data, uint8_t len) |
| read either 4 or 32 bytes of data into given slot More... | |
| ATCA_STATUS | atcab_write (uint8_t zone, uint16_t address, const uint8_t *value, const uint8_t *mac) |
| The Write command writes either one four byte word or an 8-word block of 32 bytes to one of the EEPROM zones on the device. Depending upon the value of the WriteConfig byte for this slot, the data may be required to be encrypted by the system prior to being sent to the device. This command cannot be used to write slots configured as ECC private keys. More... | |
| ATCA_STATUS | atcab_write_zone (uint8_t zone, uint16_t slot, uint8_t block, uint8_t offset, const uint8_t *data, uint8_t len) |
| Write either 4 or 32 bytes of data into a device zone. More... | |
| ATCA_STATUS | atcab_write_bytes_zone (uint8_t zone, uint16_t slot, size_t offset_bytes, const uint8_t *data, size_t length) |
| Write data into config, otp, or data zone with a given byte offset and length. Offset and length must be multiples of a word (4 bytes). More... | |
| ATCA_STATUS | atcab_read_bytes_zone (uint8_t zone, uint16_t slot, size_t offset_bytes, uint8_t *data, size_t length) |
| Read data from config, otp, or data zone with a given byte offset and length. More... | |
| ATCA_STATUS | atcab_read_serial_number (uint8_t *serial_number) |
| read the serial number of the device More... | |
| ATCA_STATUS | atcab_read_pubkey (uint16_t slot8toF, uint8_t *pubkey) |
| reads a pub key from a readable data slot versus atcab_get_pubkey which generates a pubkey from a private key slot More... | |
| ATCA_STATUS | atcab_write_pubkey (uint16_t slot8toF, const uint8_t *pubkey) |
| Writes a pub key from to a data slot. More... | |
| ATCA_STATUS | atcab_read_sig (uint8_t slot8toF, uint8_t *sig) |
| reads a signature found in one of slots 8 through F. More... | |
| ATCA_STATUS | atcab_read_ecc_config_zone (uint8_t *config_data) |
| read the config zone by block by block for 32 byte read, offset is ignored data receives the contents read from the slot Config zone can be read regardless of it being locked or unlocked More... | |
| ATCA_STATUS | atcab_write_ecc_config_zone (const uint8_t *config_data) |
| given an ECC configuration zone buffer, write its parts to the device's config zone More... | |
| ATCA_STATUS | atcab_read_sha_config_zone (uint8_t *config_data) |
| given an SHA configuration zone buffer, read its parts from the device's config zone More... | |
| ATCA_STATUS | atcab_write_sha_config_zone (const uint8_t *config_data) |
| given an SHA configuration zone buffer, write its parts to the device's config zone More... | |
| ATCA_STATUS | atcab_read_config_zone (uint8_t *config_data) |
| given an SHA configuration zone buffer and dev type, read its parts from the device's config zone More... | |
| ATCA_STATUS | atcab_write_config_zone (const uint8_t *config_data) |
| given an SHA configuration zone buffer and dev type, write its parts to the device's config zone More... | |
| ATCA_STATUS | atcab_cmp_config_zone (uint8_t *config_data, bool *same_config) |
| This function compares all writable bytes in the configuration zone that is passed in to the bytes on the device. More... | |
| ATCA_STATUS | atcab_read_enc (uint16_t key_id, uint8_t block, uint8_t *data, const uint8_t *enckey, const uint16_t enckeyid) |
| Read 32 bytes of data from the given slot. The function returns clear text bytes. Encrypted bytes are read over the wire, then subsequently decrypted Data zone must be locked and the slot configuration must be set to encrypted read for the block to be successfully read. More... | |
| ATCA_STATUS | atcab_write_enc (uint16_t key_id, uint8_t block, const uint8_t *data, const uint8_t *enckey, const uint16_t enckeyid) |
| Write 32 bytes of data into given slot. The function takes clear text bytes, but encrypts them for writing over the wire Data zone must be locked and the slot configuration must be set to encrypted write for the block to be successfully written. More... | |
| ATCA_STATUS | atcab_lock (uint8_t mode, uint16_t summary, uint8_t *lock_response) |
| The Lock command prevents future modifications of the Configuration and/or Data and OTP zones. If the device is so configured, then this command can be used to lock individual data slots. This command fails if the designated area is already locked. More... | |
| ATCA_STATUS | atcab_lock_config_zone (uint8_t *lock_response) |
| Unconditionally (no CRC required) lock the config zone. More... | |
| ATCA_STATUS | atcab_lock_config_zone_crc (uint16_t crc) |
| Lock the config zone with summary CRC. More... | |
| ATCA_STATUS | atcab_lock_data_zone (uint8_t *lock_response) |
| Unconditionally (no CRC required) lock the data zone (slots and OTP). More... | |
| ATCA_STATUS | atcab_lock_data_zone_crc (uint16_t crc) |
| Lock the data zone (slots and OTP) with summary CRC. More... | |
| ATCA_STATUS | atcab_lock_data_slot (uint8_t slot, uint8_t *lock_response) |
| Lock an individual slot in the data zone on an ATECC device. Not available for ATSHA devices. Slot must be configured to be slot lockable (KeyConfig.Lockable=1). More... | |
| ATCA_STATUS | atcab_priv_write (uint16_t key_id, const uint8_t priv_key[36], uint8_t write_key_slot, const uint8_t write_key[32]) |
| write a P256 private key in given slot using mac computation More... | |
| ATCA_STATUS | atcab_genkey_base (uint8_t mode, uint16_t key_id, const uint8_t *other_data, uint8_t *public_key) |
| This command can generate a private key, compute a public key, and/or compute a digest of of a public key. More... | |
| ATCA_STATUS | atcab_genkey (uint16_t key_id, uint8_t *public_key) |
| Generate a new random private key and return the public key. More... | |
| ATCA_STATUS | atcab_get_pubkey (uint16_t key_id, uint8_t *public_key) |
| returns a public key found in a designated slot. The slot must be configured as a slot with a private key. This method will use GenKey to generate the corresponding public key from the private key in the given slot. More... | |
| ATCA_STATUS | atcab_sign_base (uint8_t mode, uint16_t key_id, uint8_t *signature) |
| The Sign command generates a signature using the ECDSA algorithm. More... | |
| ATCA_STATUS | atcab_sign (uint16_t key_id, const uint8_t *msg, uint8_t *signature) |
| Sign a 32-byte message using the private key in the specified slot. More... | |
| ATCA_STATUS | atcab_sign_internal (uint16_t key_id, bool is_invalidate, bool is_full_sn, uint8_t *signature) |
| Sign an internally generated message. More... | |
| ATCA_STATUS | atcab_verify (uint8_t mode, uint16_t key_id, const uint8_t *signature, const uint8_t *public_key, const uint8_t *other_data) |
| The Verify command takes an ECDSA [R,S] signature and verifies that it is correctly generated from a given message and public key. In all cases, the signature is an input to the command. More... | |
| ATCA_STATUS | atcab_verify_extern (const uint8_t *message, const uint8_t *signature, const uint8_t *public_key, bool *is_verified) |
| Verify a signature (ECDSA verify operation) with all components (message, signature, and public key) supplied. Uses the CryptoAuthentication hardware instead of software. More... | |
| ATCA_STATUS | atcab_verify_stored (const uint8_t *message, const uint8_t *signature, uint16_t key_id, bool *is_verified) |
| Verify a signature and message (ECDSA verify operation) against a public key stored in a specified slot. More... | |
| ATCA_STATUS | atcab_verify_validate (uint16_t key_id, const uint8_t *signature, const uint8_t *other_data, bool *is_verified) |
| Validate a public key stored in a slot. More... | |
| ATCA_STATUS | atcab_verify_invalidate (uint16_t key_id, const uint8_t *signature, const uint8_t *other_data, bool *is_verified) |
| Invalidate a public key stored in a slot. More... | |
| ATCA_STATUS | atcab_ecdh (uint16_t key_id, const uint8_t *pubkey, uint8_t *pms) |
| ECDH command with premaster secret returned in the response. More... | |
| ATCA_STATUS | atcab_ecdh_enc (uint16_t key_id, const uint8_t *pubkey, uint8_t *pms, const uint8_t *enckey, uint16_t enckeyid) |
| ECDH command with premaster secret read (encrypted) from next slot. More... | |
| ATCA_STATUS | atcab_gendig (uint8_t zone, uint16_t key_id, const uint8_t *other_data, uint8_t other_data_size) |
| Issues a GenDig command, which performs a SHA256 hash on the source data indicated by zone with the contents of TempKey. See the CryptoAuth datasheet for your chip to see what the values of zone correspond to. More... | |
| ATCA_STATUS | atcab_mac (uint8_t mode, uint16_t key_id, const uint8_t *challenge, uint8_t *digest) |
| Get a 32 byte MAC from the CryptoAuth device given a key ID and a challenge. More... | |
| ATCA_STATUS | atcab_checkmac (uint8_t mode, uint16_t key_id, const uint8_t *challenge, const uint8_t *response, const uint8_t *other_data) |
| Compares a MAC response with input values. More... | |
| ATCA_STATUS | atcab_hmac (uint8_t mode, uint16_t key_id, uint8_t *digest) |
| The HMAC command computes an HMAC/SHA-256 digest of a key stored in the device, a challenge, and other information on the device. The output of this command is the output of the HMAC algorithm computed over this key and message. If the message includes the serial number of the device, the response is said to be "diversified". More... | |
| ATCA_STATUS | atcab_derivekey (uint8_t random, uint16_t key_id, uint8_t *mac) |
| send a DeriveKey Command to the device More... | |
| ATCA_STATUS | atcab_sha_base (uint8_t mode, uint16_t length, const uint8_t *message, uint8_t *digest) |
| The SHA command computes a SHA-256 digest for general purpose use by the system. Any message length can be accommodated. The system is responsible for sending the pad and length bytes with the last block for ATSHA devices. More... | |
| ATCA_STATUS | atcab_sha_start (void) |
| Initialize SHA-256 calculation engine. More... | |
| ATCA_STATUS | atcab_sha_update (const uint8_t *message) |
| Adds the message to be digested. More... | |
| ATCA_STATUS | atcab_sha_end (uint8_t *digest, uint16_t length, const uint8_t *message) |
| The SHA-256 calculation is complete. More... | |
| ATCA_STATUS | atcab_sha (uint16_t length, const uint8_t *message, uint8_t *digest) |
| Computes a SHA-256 digest. More... | |
| ATCA_STATUS | atcab_updateextra (uint8_t mode, uint16_t new_value) |
| The UpdateExtra command is used to update the values of the two extra bytes within the Configuration zone (bytes 84 and 85). More... | |
| ATCA_STATUS | atcab_hw_sha2_256_init (atca_sha256_ctx_t *ctx) |
| ATCA_STATUS | atcab_hw_sha2_256_update (atca_sha256_ctx_t *ctx, const uint8_t *data, size_t data_size) |
| ATCA_STATUS | atcab_hw_sha2_256_finish (atca_sha256_ctx_t *ctx, uint8_t digest[ATCA_SHA2_256_DIGEST_SIZE]) |
| ATCA_STATUS | atcab_hw_sha2_256 (const uint8_t *data, size_t data_size, uint8_t digest[ATCA_SHA2_256_DIGEST_SIZE]) |
| ATCA_STATUS | packHex (const char *asciiHex, int asciiHexLen, char *packedHex, int *packedLen) |
| Remove white space from a ASCII hex string. More... | |
| bool | isDigit (char c) |
| Checks to see if a character is an ASCII representation of a digit ((c ge '0') and (c le '9')) More... | |
| bool | isWhiteSpace (char c) |
| Checks to see if a character is whitespace ((c == ' ') || (c == '') || (c == '') || (c == ' ')) More... | |
| bool | isAlpha (char c) |
| Checks to see if a character is an ASCII representation of hex ((c >= 'A') and (c <= 'F')) || ((c >= 'a') and (c <= 'f')) More... | |
| bool | isHexAlpha (char c) |
| Checks to see if a character is an ASCII representation of hex ((c >= 'A') and (c <= 'F')) || ((c >= 'a') and (c <= 'f')) More... | |
| bool | isHex (char c) |
| Returns true if this character is a valid hex character or if this is whitespace (The character can be included in a valid hexstring). More... | |
| bool | isHexDigit (char c) |
| Returns true if this character is a valid hex character. More... | |
| ATCA_STATUS | packBase64 (const char *asciiBase64, int asciiBase64Len, char *packedBase64, int *packedLen) |
| Remove white space from a base 64 string. More... | |
| bool | isBase64 (char c) |
| Returns true if this character is a valid base 64 character or if this is whitespace (A character can be included in a valid base 64 string). More... | |
| bool | isBase64Digit (char c) |
| Returns true if this character is a valid base 64 character. More... | |
| char | base64Index (char c) |
| Returns the base 64 index of the given character. More... | |
| char | base64Char (char id) |
| Returns the base 64 character of the given index. More... | |
| ATCA_STATUS | atcab_base64decode (const char *encoded, size_t encodedLen, uint8_t *byteArray, size_t *arrayLen) |
| Decode base 64 encoded characters into a byte array. More... | |
| ATCA_STATUS | atcab_base64encode (const uint8_t *byteArray, size_t arrayLen, char *encoded, size_t *encodedLen) |
| Encode a byte array into base 64 encoded characters with character every 64 bytes. More... | |
| ATCA_STATUS | atcab_base64encode_ (const uint8_t *byteArray, size_t arrayLen, char *encoded, size_t *encodedLen, bool addNewLine) |
| Encode a byte array into base 64 encoded characters. Optionally with character every 64 bytes. More... | |
These methods provide the most convenient, simple API to CryptoAuth chips.
| #define atcab_bin2hex |
| typedef struct atca_sha256_ctx atca_sha256_ctx_t |
| ATCA_STATUS atcab_base64decode | ( | const char * | encoded, |
| size_t | encodedLen, | ||
| uint8_t * | byteArray, | ||
| size_t * | arrayLen | ||
| ) |
Decode base 64 encoded characters into a byte array.
| [in] | encoded | The input base 64 encoded characters that will be decoded. |
| [in] | encodedLen | The length of the encoded characters |
| [out] | byteArray | The output buffer that contains the decoded byte array |
| [in,out] | arrayLen | Input: The size of the decoded buffer Output: The length of the decoded byte array |
| ATCA_STATUS atcab_base64encode | ( | const uint8_t * | byteArray, |
| size_t | arrayLen, | ||
| char * | encoded, | ||
| size_t * | encodedLen | ||
| ) |
Encode a byte array into base 64 encoded characters with
character every 64 bytes.
| [in] | byteArray | The input byte array that will be converted to base 64 encoded characters. |
| [in] | arrayLen | The length of the byte array |
| [out] | encoded | The output converted to base 64 encoded characters. The will be added every 64 characters. |
| [in,out] | encodedLen | Input: The size of the encoded buffer Output: The length of the encoded base 64 character string including the additional characters |
| ATCA_STATUS atcab_base64encode_ | ( | const uint8_t * | byteArray, |
| size_t | arrayLen, | ||
| char * | encoded, | ||
| size_t * | encodedLen, | ||
| bool | addNewLine | ||
| ) |
Encode a byte array into base 64 encoded characters. Optionally with
character every 64 bytes.
| [in] | byteArray | The input byte array that will be converted to base 64 encoded characters. |
| [in] | arrayLen | The length of the byte array |
| [out] | encoded | The output converted to base 64 encoded characters. The will optionally be added every 64 characters. |
| [in,out] | encodedLen | Input: The size of the encoded buffer Output: The length of the encoded base 64 character string including the additional characters |
| [in] | addNewLine | Optionally add a every 64 characters |
| ATCA_STATUS atcab_cfg_discover | ( | ATCAIfaceCfg | cfgArray[], |
| int | max | ||
| ) |
| ATCA_STATUS atcab_challenge | ( | const uint8_t * | challenge | ) |
send a challenge to the device (a pass-through nonce)
| [in] | challenge | - pointer to 32 bytes of data which will be sent as the challenge |
| ATCA_STATUS atcab_challenge_seed_update | ( | const uint8_t * | seed, |
| uint8_t * | rand_out | ||
| ) |
send a challenge to the device (a seed update nonce)
| [in] | seed | - pointer to 32 bytes of data which will be sent as the challenge |
| [out] | rand_out | - points to space to receive random number |
| ATCA_STATUS atcab_checkmac | ( | uint8_t | mode, |
| uint16_t | key_id, | ||
| const uint8_t * | challenge, | ||
| const uint8_t * | response, | ||
| const uint8_t * | other_data | ||
| ) |
Compares a MAC response with input values.
| [in] | mode | Controls which fields within the device are used in the message |
| [in] | key_id | The key in the CryptoAuth device to use for the MAC |
| [in] | challenge | The 32 byte challenge number |
| [in] | response | The 32 byte mac response number |
| [in] | other_data | The 13 byte other data number |
| ATCA_STATUS atcab_cmp_config_zone | ( | uint8_t * | config_data, |
| bool * | same_config | ||
| ) |
This function compares all writable bytes in the configuration zone that is passed in to the bytes on the device.
| [in] | config_data | pointer to all 128 bytes in configuration zone. Not used if NULL. |
| [out] | same_config | pointer to boolean status whether config data passed in matches the actual config zone |
| ATCA_STATUS atcab_derivekey | ( | uint8_t | random, |
| uint16_t | key_id, | ||
| uint8_t * | mac | ||
| ) |
send a DeriveKey Command to the device
| [in] | random | - bit 2: must match the value in TempKey.SourceFlag |
| [in] | key_id | - Key slot to be written |
| [in] | mac | - Optional MAC used to validate operation |
| ATCA_STATUS atcab_ecdh | ( | uint16_t | key_id, |
| const uint8_t * | pubkey, | ||
| uint8_t * | pms | ||
| ) |
ECDH command with premaster secret returned in the response.
| [in] | key_id | Slot of key for ECDH computation |
| [in] | pubkey | Public key input to ECDH calculation. X and Y integers in big-endian format. 64 bytes for P256 key. |
| [out] | pms | Computed ECDH premaster secret is returned here. 32 bytes. |
| ATCA_STATUS atcab_ecdh_enc | ( | uint16_t | key_id, |
| const uint8_t * | pubkey, | ||
| uint8_t * | pms, | ||
| const uint8_t * | enckey, | ||
| uint16_t | enckeyid | ||
| ) |
ECDH command with premaster secret read (encrypted) from next slot.
| [in] | key_id | Slot of key for ECDH computation |
| [in] | pubkey | Public key input to ECDH calculation. X and Y integers in big-endian format. 64 bytes for P256 key. |
| [out] | pms | Computed ECDH premaster secret is returned here. 32 bytes. |
| [in] | enckey | Read key for the premaster secret slot (slotid+1). |
| [in] | enckeyid | Read key slot for enckey. |
| ATCA_STATUS atcab_gendig | ( | uint8_t | zone, |
| uint16_t | key_id, | ||
| const uint8_t * | other_data, | ||
| uint8_t | other_data_size | ||
| ) |
Issues a GenDig command, which performs a SHA256 hash on the source data indicated by zone with the contents of TempKey. See the CryptoAuth datasheet for your chip to see what the values of zone correspond to.
| [in] | zone | Designates the source of the data to hash with TempKey. |
| [in] | key_id | Indicates the key, OTP block, or message order for shared nonce mode. |
| [in] | other_data | Four bytes of data for SHA calculation when using a NoMac key, 32 bytes for "Shared Nonce" mode, otherwise ignored (can be NULL). |
| [in] | other_data_size | Size of other_data in bytes. |
| ATCA_STATUS atcab_genkey | ( | uint16_t | key_id, |
| uint8_t * | public_key | ||
| ) |
Generate a new random private key and return the public key.
| [in] | key_id | Slot where an ECC private key is configured. |
| [out] | public_key | Public key will be returned here. Format will be the X and Y integers in big-endian format. 64 bytes for P256 curve. Set to NULL if public key isn't required. |
| ATCA_STATUS atcab_genkey_base | ( | uint8_t | mode, |
| uint16_t | key_id, | ||
| const uint8_t * | other_data, | ||
| uint8_t * | public_key | ||
| ) |
This command can generate a private key, compute a public key, and/or compute a digest of of a public key.
| [in] | mode | Mode bit mask determines what operations the GenKey command performs. Bit 4 overrides bits 2 and 3. Bit 2 will create a new random private key in key_id and return the public key. Leave 0 to just calculate the public key from an existing private key. Bit 3 will create a PubKey digest from the calculated public key and store it in TempKey. Bit 4 will create a PubKey digest from the public key stored in key_id and store it in TempKey. |
| [in] | key_id | Slot to perform the GenKey command on. |
| [in] | other_data | If bit 4 of mode is set, these 3 bytes replace Param1 and Param2 in the PubKey digest calculation. Can be set to NULL otherwise. |
| [out] | public_key | If the mode indicates a public key will be calculated, it will be returned here. Format will be the X and Y integers in big-endian format. 64 bytes for P256 curve. Set to NULL if public key isn't required. |
| ATCA_STATUS atcab_get_addr | ( | uint8_t | zone, |
| uint16_t | slot, | ||
| uint8_t | block, | ||
| uint8_t | offset, | ||
| uint16_t * | addr | ||
| ) |
Compute the address given the zone, slot, block, and offset.
| [in] | zone | |
| [in] | slot | |
| [in] | block | |
| [in] | offset | |
| [in] | addr |
| ATCA_STATUS atcab_get_pubkey | ( | uint16_t | key_id, |
| uint8_t * | public_key | ||
| ) |
returns a public key found in a designated slot. The slot must be configured as a slot with a private key. This method will use GenKey to generate the corresponding public key from the private key in the given slot.
| [in] | key_id | ID of the private key slot |
| [out] | public_key | - pointer to space receiving the contents of the public key that was generated |
| ATCA_STATUS atcab_get_zone_size | ( | uint8_t | zone, |
| uint16_t | slot, | ||
| size_t * | size | ||
| ) |
Gets the size of the specified zone in bytes.
| [in] | zone | Zone to get size information from. Config(0), OTP(1), or Data(2) which requires a slot. |
| [in] | slot | If zone is Data(2), the slot to query for size. |
| [out] | size | Zone size is returned here. |
| ATCADevice atcab_getDevice | ( | void | ) |
a way to get the global device object. Generally for more sophisticated users of atca
| ATCA_STATUS atcab_hmac | ( | uint8_t | mode, |
| uint16_t | key_id, | ||
| uint8_t * | digest | ||
| ) |
The HMAC command computes an HMAC/SHA-256 digest of a key stored in the device, a challenge, and other information on the device. The output of this command is the output of the HMAC algorithm computed over this key and message. If the message includes the serial number of the device, the response is said to be "diversified".
| [in] | mode | Controls which fields within the device are used in the message. |
| [in] | key_id | Which key is to be used to generate the response. Bits 0:3 only are used to select a slot but all 16 bits are used in the HMAC message. |
| [out] | digest | HMAC digest is returned in this buffer (32 bytes). |
| ATCA_STATUS atcab_hw_sha2_256 | ( | const uint8_t * | data, |
| size_t | data_size, | ||
| uint8_t | digest[ATCA_SHA2_256_DIGEST_SIZE] | ||
| ) |
| ATCA_STATUS atcab_hw_sha2_256_finish | ( | atca_sha256_ctx_t * | ctx, |
| uint8_t | digest[ATCA_SHA2_256_DIGEST_SIZE] | ||
| ) |
| ATCA_STATUS atcab_hw_sha2_256_init | ( | atca_sha256_ctx_t * | ctx | ) |
| ATCA_STATUS atcab_hw_sha2_256_update | ( | atca_sha256_ctx_t * | ctx, |
| const uint8_t * | data, | ||
| size_t | data_size | ||
| ) |
| ATCA_STATUS atcab_idle | ( | void | ) |
idle the CryptoAuth device
| ATCA_STATUS atcab_info | ( | uint8_t * | revision | ) |
get the device revision information
| [out] | revision | - 4-byte storage for receiving the revision number from the device |
| ATCA_STATUS atcab_init | ( | ATCAIfaceCfg * | cfg | ) |
atcab_init is called once for the life of the application and creates a global ATCADevice object used by Basic API. This method builds a global ATCADevice instance behinds the scenes that's used for all Basic API operations
| [in] | cfg | is a pointer to an interface configuration. This is usually a predefined configuration found in atca_cfgs.h |
| ATCA_STATUS atcab_init_device | ( | ATCADevice | cadevice | ) |
atcab_init_device can be used to initialize the global ATCADevice object to point to one of your choosing for use with all the atcab_ basic API.
| [in] | cadevice | ATCADevice instance to use as the global Basic API crypto device instance |
| ATCA_STATUS atcab_is_locked | ( | uint8_t | zone, |
| bool * | islocked | ||
| ) |
Query to see if the specified zone is locked.
| [in] | zone | The zone to query for locked (use LOCK_ZONE_CONFIG or LOCK_ZONE_DATA) |
| [out] | islocked | true if the specified zone is locked |
| ATCA_STATUS atcab_is_slot_locked | ( | uint8_t | slot, |
| bool * | islocked | ||
| ) |
Query to see if the specified slot is locked.
| [in] | slot | The slot to query for locked (slot 0-15) |
| [out] | islocked | true if the specified slot is locked |
| ATCA_STATUS atcab_lock | ( | uint8_t | mode, |
| uint16_t | summary, | ||
| uint8_t * | lock_response | ||
| ) |
The Lock command prevents future modifications of the Configuration and/or Data and OTP zones. If the device is so configured, then this command can be used to lock individual data slots. This command fails if the designated area is already locked.
| [in] | mode | Zone, and/or slot, and summary check (bit 7). |
| [in] | summary | CRC of the config or data zones. Ignored for slot locks or when mode bit 7 is set. |
| [out] | lock_response | Command response is returned here. Can be NULL if not required. |
| ATCA_STATUS atcab_lock_config_zone | ( | uint8_t * | lock_response | ) |
Unconditionally (no CRC required) lock the config zone.
| [out] | lock_response | Pointer to the lock response from the chip. 0 is successful lock. |
| ATCA_STATUS atcab_lock_config_zone_crc | ( | uint16_t | crc | ) |
Lock the config zone with summary CRC.
The CRC is calculated over the entire config zone contents. 88 bytes for ATSHA devices, 128 bytes for ATECC devices. Lock will fail if the provided CRC doesn't match the internally calculated one.
| [in] | crc | Expected CRC over the config zone. |
| ATCA_STATUS atcab_lock_data_slot | ( | uint8_t | slot, |
| uint8_t * | lock_response | ||
| ) |
Lock an individual slot in the data zone on an ATECC device. Not available for ATSHA devices. Slot must be configured to be slot lockable (KeyConfig.Lockable=1).
| [in] | slot | Slot to be locked in data zone. |
| [out] | lock_response | Pointer to the lock response from the chip. 0 is successful lock. |
| ATCA_STATUS atcab_lock_data_zone | ( | uint8_t * | lock_response | ) |
Unconditionally (no CRC required) lock the data zone (slots and OTP).
ConfigZone must be locked and DataZone must be unlocked for the zone to be successfully locked.
| [out] | lock_response | Pointer to the lock response from the chip. 0 is successful lock. |
| ATCA_STATUS atcab_lock_data_zone_crc | ( | uint16_t | crc | ) |
Lock the data zone (slots and OTP) with summary CRC.
The CRC is calculated over the concatenated contents of all the slots and OTP at the end. Private keys (KeyConfig.Private=1) are skipped. Lock will fail if the provided CRC doesn't match the internally calculated one.
| [in] | crc | Expected CRC over the data zone. |
| ATCA_STATUS atcab_mac | ( | uint8_t | mode, |
| uint16_t | key_id, | ||
| const uint8_t * | challenge, | ||
| uint8_t * | digest | ||
| ) |
Get a 32 byte MAC from the CryptoAuth device given a key ID and a challenge.
| [in] | mode | Controls which fields within the device are used in the message |
| [in] | key_id | The key in the CryptoAuth device to use for the MAC |
| [in] | challenge | The 32 byte challenge number |
| [out] | digest | The response of the MAC command using the given challenge |
| ATCA_STATUS atcab_nonce | ( | const uint8_t * | tempkey | ) |
Execute a pass-through Nonce command to initialize TempKey to the specified value.
| [in] | tempkey | - pointer to 32 bytes of data which will be used to initialize TempKey |
| ATCA_STATUS atcab_nonce_base | ( | uint8_t | mode, |
| const uint8_t * | num_in, | ||
| uint8_t * | rand_out | ||
| ) |
send a challenge to the device (a non-seed update nonce)
| [in] | seed | - pointer to 32 bytes of data which will be sent as the challenge |
| [out] | rand_out | - points to space to receive random number |
| ATCA_STATUS atcab_nonce_rand | ( | const uint8_t * | seed, |
| uint8_t * | rand_out | ||
| ) |
Initialize TempKey with a random Nonce.
| [in] | seed | - pointer to 20 bytes of data which will be used to calculate TempKey |
| [out] | rand_out | - pointer to 32 bytes of data that is the output of the Nonce command |
| ATCA_STATUS atcab_priv_write | ( | uint16_t | key_id, |
| const uint8_t | priv_key[36], | ||
| uint8_t | write_key_slot, | ||
| const uint8_t | write_key[32] | ||
| ) |
write a P256 private key in given slot using mac computation
| [in] | key_id | |
| [in] | priv_key | first 4 bytes of 36 bytes should be zero for P256 curve |
| [in] | write_key_slot | slot to make a session key |
| [in] | write_key | key to make a session key |
| ATCA_STATUS atcab_random | ( | uint8_t * | rand_out | ) |
Get a 32 byte random number from the CryptoAuth device.
| [out] | rand_out | ptr to 32 bytes of storage for random number |
| ATCA_STATUS atcab_read_bytes_zone | ( | uint8_t | zone, |
| uint16_t | slot, | ||
| size_t | offset_bytes, | ||
| uint8_t * | data, | ||
| size_t | length | ||
| ) |
Read data from config, otp, or data zone with a given byte offset and length.
| [in] | zone | Zone to read data from: Config(0), OTP(1), or Data(2). |
| [in] | slot | If zone is Data(2), the slot number to read from. Ignored for all other zones. |
| [in] | offset_bytes | Byte offset within the zone to read from. |
| [out] | data | Buffer to read data into. |
| [in] | length | Number of bytes to read. |
| ATCA_STATUS atcab_read_config_zone | ( | uint8_t * | config_data | ) |
given an SHA configuration zone buffer and dev type, read its parts from the device's config zone
| [out] | config_data | pointer to buffer containing a contiguous set of bytes to write to the config zone |
| ATCA_STATUS atcab_read_ecc_config_zone | ( | uint8_t * | config_data | ) |
read the config zone by block by block for 32 byte read, offset is ignored data receives the contents read from the slot Config zone can be read regardless of it being locked or unlocked
| [in] | config_data | pointer to buffer containing a contiguous set of bytes to read from the config zone returns ATCA_STATUS |
| ATCA_STATUS atcab_read_enc | ( | uint16_t | key_id, |
| uint8_t | block, | ||
| uint8_t * | data, | ||
| const uint8_t * | enckey, | ||
| const uint16_t | enckeyid | ||
| ) |
Read 32 bytes of data from the given slot. The function returns clear text bytes. Encrypted bytes are read over the wire, then subsequently decrypted Data zone must be locked and the slot configuration must be set to encrypted read for the block to be successfully read.
| [in] | key_id | The slot id for the encrypted read |
| [in] | block | The block id in the specified slot |
| [out] | data | The 32 bytes of clear text data that was read encrypted from the slot, then decrypted |
| [in] | enckey | The key to encrypt with for writing |
| [in] | enckeyid | The keyid of the parent encryption key returns ATCA_STATUS |
| ATCA_STATUS atcab_read_pubkey | ( | uint16_t | slot8toF, |
| uint8_t * | pubkey | ||
| ) |
reads a pub key from a readable data slot versus atcab_get_pubkey which generates a pubkey from a private key slot
| [in] | slot8toF | - slot number to read, expected value is 0x8 through 0xF |
| [out] | pubkey | - space to receive read pubkey |
| ATCA_STATUS atcab_read_serial_number | ( | uint8_t * | serial_number | ) |
read the serial number of the device
| [out] | serial_number | pointer to space to receive serial number. This space should be 9 bytes long |
| ATCA_STATUS atcab_read_sha_config_zone | ( | uint8_t * | config_data | ) |
given an SHA configuration zone buffer, read its parts from the device's config zone
| [out] | config_data | pointer to buffer containing a contiguous set of bytes to write to the config zone |
| ATCA_STATUS atcab_read_sig | ( | uint8_t | slot8toF, |
| uint8_t * | sig | ||
| ) |
reads a signature found in one of slots 8 through F.
| [in] | slot8toF | - which slot to read |
| [out] | sig | - pointer to the space to receive the signature found in the slot |
| ATCA_STATUS atcab_read_zone | ( | uint8_t | zone, |
| uint16_t | slot, | ||
| uint8_t | block, | ||
| uint8_t | offset, | ||
| uint8_t * | data, | ||
| uint8_t | len | ||
| ) |
read either 4 or 32 bytes of data into given slot
for 32 byte read, offset is ignored data receives the contents read from the slot
data zone must be locked and the slot configuration must not be secret for a slot to be successfully read
| [in] | zone | |
| [in] | slot | |
| [in] | block | |
| [in] | offset | |
| [in] | data | |
| [in] | len | Must be either 4 or 32 returns ATCA_STATUS |
| ATCA_STATUS atcab_release | ( | void | ) |
release (free) the global ATCADevice instance. This must be called in order to release or free up the interface.
| ATCA_STATUS atcab_sha | ( | uint16_t | length, |
| const uint8_t * | message, | ||
| uint8_t * | digest | ||
| ) |
Computes a SHA-256 digest.
| [in] | length | The number of bytes in the message parameter |
| [in] | message | - pointer to variable length message |
| [out] | digest | The SHA256 digest |
| ATCA_STATUS atcab_sha_base | ( | uint8_t | mode, |
| uint16_t | length, | ||
| const uint8_t * | message, | ||
| uint8_t * | digest | ||
| ) |
The SHA command computes a SHA-256 digest for general purpose use by the system. Any message length can be accommodated. The system is responsible for sending the pad and length bytes with the last block for ATSHA devices.
Only the Start(0) and Compute(1) modes are available for ATSHA devices.
| [in] | mode | SHA command mode: Start(0), Update/Compute(1), End(2), Public(3), HMACstart(4), MHACend(5) |
| [in] | length | Number of bytes in the Message parameter. Must be 0 for start command, 64 for update/compute commands, and 0 to 63 for end commands. KeySlot for the HMAC key if Mode is "HMACstart". |
| [in] | message | Message bytes to be hashed. Can be NULL if not required by the mode. |
| [in] | digest | Digest (32 bytes) is returned here for end commands (or compute command for ATSHA devices). |
| ATCA_STATUS atcab_sha_end | ( | uint8_t * | digest, |
| uint16_t | length, | ||
| const uint8_t * | message | ||
| ) |
The SHA-256 calculation is complete.
| [out] | digest | The SHA256 digest that is calculated |
| [in] | length | Length of any remaining data to include in hash. Max 64 bytes. |
| [in] | message | Remaining data to include in hash. NULL if length is 0. |
| ATCA_STATUS atcab_sha_start | ( | void | ) |
Initialize SHA-256 calculation engine.
| ATCA_STATUS atcab_sha_update | ( | const uint8_t * | message | ) |
Adds the message to be digested.
| [in] | message | Add 64 bytes in the message parameter to the SHA context |
| ATCA_STATUS atcab_sign | ( | uint16_t | key_id, |
| const uint8_t * | msg, | ||
| uint8_t * | signature | ||
| ) |
Sign a 32-byte message using the private key in the specified slot.
| [in] | key_id | Slot of the private key to be used to sign the message. |
| [in] | msg | 32-byte message to be signed. Typically the SHA256 hash of the full message. |
| [out] | signature | Signature is returned here. Format is R and S integers in big-endian format. 64 bytes for P256 curve. |
| ATCA_STATUS atcab_sign_base | ( | uint8_t | mode, |
| uint16_t | key_id, | ||
| uint8_t * | signature | ||
| ) |
The Sign command generates a signature using the ECDSA algorithm.
For external messages, it must be loaded into TempKey.
| [in] | mode | Bit mask indicating signing mode. Bit 0: 1 for Verify(Invalidate), 0 for Verify(Validate) and all others Bits 1-5: Must be 0 Bit 6: If bit 7 is 1, include SN[2:3] and SN[4:7] in message, ignored otherwise Bit 7: 0 for internal message, 1 for external message |
| [in] | key_id | Private key slot used to sign the message. |
| [out] | signature | Signature is returned here. Format is R and S integers in big-endian format. 64 bytes for P256 curve. |
| ATCA_STATUS atcab_sign_internal | ( | uint16_t | key_id, |
| bool | is_invalidate, | ||
| bool | is_full_sn, | ||
| uint8_t * | signature | ||
| ) |
Sign an internally generated message.
| [in] | key_id | Slot of the private key to be used to sign the message. |
| [in] | is_invalidate | Set to true if the signature will be used with the Verify(Invalidate) command. false for all other cases. |
| [in] | is_full_sn | Set to true if the message should incorporate the device's full serial number. |
| [out] | signature | Signature is returned here. Format is R and S integers in big-endian format. 64 bytes for P256 curve. |
| ATCA_STATUS atcab_sleep | ( | void | ) |
invoke sleep on the CryptoAuth device
| ATCA_STATUS atcab_updateextra | ( | uint8_t | mode, |
| uint16_t | new_value | ||
| ) |
The UpdateExtra command is used to update the values of the two extra bytes within the Configuration zone (bytes 84 and 85).
Can also be used to decrement the limited use counter associated with the key in slot NewValue.
| [in] | mode | Bit 0: 0 = update user extra (config[84]), 1 = update selector (config[85]) Bit 1: Ignores bit 0 and decrements the limited use counter associated with the key in new_value. |
| [in] | new_value | When mode bit 1 is set, this the key for which the limited use counter will be decremented. |
| ATCA_STATUS atcab_verify | ( | uint8_t | mode, |
| uint16_t | key_id, | ||
| const uint8_t * | signature, | ||
| const uint8_t * | public_key, | ||
| const uint8_t * | other_data | ||
| ) |
The Verify command takes an ECDSA [R,S] signature and verifies that it is correctly generated from a given message and public key. In all cases, the signature is an input to the command.
For the Stored, External, and ValidateExternal Modes, the contents of TempKey should contain the SHA-256 digest of the message.
| [in] | mode | Verify command mode: Stored(0), ValidateExternal(1), External(2), Validate(3), or Invalidate(7) |
| [in] | key_id | Stored Mode - The slot containing the public key to be used for the verification. ValidateExternal Mode - The slot containing the public key to be validated. External Mode - KeyID contains the curve type to be used to Verify the signature. Validate or Invalidate Mode - The slot containing the public key to be (in)validated. |
| [in] | signature | Signature to be verified. R and S integers in big-endian format. 64 bytes for P256 curve. |
| [in] | public_key | If mode is External, the public key to be used for verification. X and Y integers in big-endian format. 64 bytes for P256 curve. NULL for all other modes. |
| [in] | other_data | If mode is Validate, the bytes used to generate the message for the validation (19 bytes). NULL for all other modes. |
| ATCA_STATUS atcab_verify_extern | ( | const uint8_t * | message, |
| const uint8_t * | signature, | ||
| const uint8_t * | public_key, | ||
| bool * | is_verified | ||
| ) |
Verify a signature (ECDSA verify operation) with all components (message, signature, and public key) supplied. Uses the CryptoAuthentication hardware instead of software.
| [in] | message | 32 byte message to be verified. Typically the SHA256 hash of the full message. |
| [in] | signature | Signature to be verified. R and S integers in big-endian format. 64 bytes for P256 curve. |
| [in] | public_key | The public key to be used for verification. X and Y integers in big-endian format. 64 bytes for P256 curve. |
| [out] | is_verified | Boolean whether or not the message, signature, public key verified. |
| ATCA_STATUS atcab_verify_invalidate | ( | uint16_t | key_id, |
| const uint8_t * | signature, | ||
| const uint8_t * | other_data, | ||
| bool * | is_verified | ||
| ) |
Invalidate a public key stored in a slot.
This command can only be run after GenKey has been used to create a PubKey digest of the public key to be invalidated in TempKey (mode=0x10).
| [in] | key_id | Slot containing the public key to be invalidated. |
| [in] | signature | Signature to be verified. R and S integers in big-endian format. 64 bytes for P256 curve. |
| [in] | other_data | 19 bytes of data used to build the verification message. |
| [out] | is_verified | Boolean whether or not the message, signature, validation public key verified. |
| ATCA_STATUS atcab_verify_stored | ( | const uint8_t * | message, |
| const uint8_t * | signature, | ||
| uint16_t | key_id, | ||
| bool * | is_verified | ||
| ) |
Verify a signature and message (ECDSA verify operation) against a public key stored in a specified slot.
| [in] | message | 32 byte message to be verified. Typically the SHA256 hash of the full message. |
| [in] | signature | Signature to be verified. R and S integers in big-endian format. 64 bytes for P256 curve. |
| [in] | key_id | Slot containing the public key to be used in the verification. |
| [out] | is_verified | Boolean whether or not the message, signature, public key verified. |
| ATCA_STATUS atcab_verify_validate | ( | uint16_t | key_id, |
| const uint8_t * | signature, | ||
| const uint8_t * | other_data, | ||
| bool * | is_verified | ||
| ) |
Validate a public key stored in a slot.
This command can only be run after GenKey has been used to create a PubKey digest of the public key to be validated in TempKey (mode=0x10).
| [in] | key_id | Slot containing the public key to be validated. |
| [in] | signature | Signature to be verified. R and S integers in big-endian format. 64 bytes for P256 curve. |
| [in] | other_data | 19 bytes of data used to build the verification message. |
| [out] | is_verified | Boolean whether or not the message, signature, validation public key verified. |
| ATCA_STATUS atcab_version | ( | char * | verstr | ) |
returns a version string for the CryptoAuthLib release. The format of the version string returned is "yyyymmdd"
| [out] | verstr | ptr to space to receive version string |
| ATCA_STATUS atcab_wakeup | ( | void | ) |
wakeup the CryptoAuth device
| ATCA_STATUS atcab_write | ( | uint8_t | zone, |
| uint16_t | address, | ||
| const uint8_t * | value, | ||
| const uint8_t * | mac | ||
| ) |
The Write command writes either one four byte word or an 8-word block of 32 bytes to one of the EEPROM zones on the device. Depending upon the value of the WriteConfig byte for this slot, the data may be required to be encrypted by the system prior to being sent to the device. This command cannot be used to write slots configured as ECC private keys.
| [in] | zone | Zone/Param1 for the write command. |
| [in] | address | Addres/Param2 for the write command. |
| [in] | value | Plain-text data to be written or cipher-text for encrypted writes. 32 or 4 bytes depending on bit 7 in the zone. |
| [in] | mac | MAC required for encrypted writes (32 bytes). Set to NULL if not required. |
| ATCA_STATUS atcab_write_bytes_zone | ( | uint8_t | zone, |
| uint16_t | slot, | ||
| size_t | offset_bytes, | ||
| const uint8_t * | data, | ||
| size_t | length | ||
| ) |
Write data into config, otp, or data zone with a given byte offset and length. Offset and length must be multiples of a word (4 bytes).
Config zone must be unlocked for writes to that zone. Data zone must be locked for writes to OTP and Data zones.
| [in] | zone | Zone to write data to: Config(0), OTP(1), or Data(2). |
| [in] | slot | If zone is Data(2), the slot number to write to. Ignored for all other zones. |
| [in] | offset_bytes | Byte offset within the zone to write to. Must be a multiple of a word (4 bytes). |
| [in] | data | Data to be written. |
| [in] | length | Number of bytes to be written. Must be a multiple of a word (4 bytes). |
| ATCA_STATUS atcab_write_config_zone | ( | const uint8_t * | config_data | ) |
given an SHA configuration zone buffer and dev type, write its parts to the device's config zone
| [in] | config_data | pointer to buffer containing a contiguous set of bytes to write to the config zone |
| ATCA_STATUS atcab_write_ecc_config_zone | ( | const uint8_t * | config_data | ) |
given an ECC configuration zone buffer, write its parts to the device's config zone
| [in] | config_data | pointer to buffer containing a contiguous set of bytes to write to the config zone |
| ATCA_STATUS atcab_write_enc | ( | uint16_t | key_id, |
| uint8_t | block, | ||
| const uint8_t * | data, | ||
| const uint8_t * | enckey, | ||
| const uint16_t | enckeyid | ||
| ) |
Write 32 bytes of data into given slot. The function takes clear text bytes, but encrypts them for writing over the wire Data zone must be locked and the slot configuration must be set to encrypted write for the block to be successfully written.
| [in] | key_id | |
| [in] | block | |
| [in] | data | The 32 bytes of clear text data to be written to the slot |
| [in] | enckey | The key to encrypt with for writing |
| [in] | enckeyid | The keyid of the parent encryption key returns ATCA_STATUS |
| ATCA_STATUS atcab_write_pubkey | ( | uint16_t | slot8toF, |
| const uint8_t * | pubkey | ||
| ) |
Writes a pub key from to a data slot.
| [in] | slot8toF | Slot number to write, expected value is 0x8 through 0xF |
| [out] | pubkey | The public key to write into the slot specified |
| ATCA_STATUS atcab_write_sha_config_zone | ( | const uint8_t * | config_data | ) |
given an SHA configuration zone buffer, write its parts to the device's config zone
| [in] | config_data | pointer to buffer containing a contiguous set of bytes to write to the config zone |
| ATCA_STATUS atcab_write_zone | ( | uint8_t | zone, |
| uint16_t | slot, | ||
| uint8_t | block, | ||
| uint8_t | offset, | ||
| const uint8_t * | data, | ||
| uint8_t | len | ||
| ) |
Write either 4 or 32 bytes of data into a device zone.
See ECC108A datasheet, datazone address values, table 9-8
| [in] | zone | Device zone to write to (0=config, 1=OTP, 2=data). |
| [in] | slot | If writing to the data zone, whit is the slot to write to, otherwise it should be 0. |
| [in] | block | 32-byte block to write to. |
| [in] | offset | 4-byte word within the specified block to write to. If performing a 32-byte write, this should be 0. |
| [in] | data | Data to be written. |
| [in] | len | Number of bytes to be written. Must be either 4 or 32. |
| char base64Char | ( | char | id | ) |
Returns the base 64 character of the given index.
| [in] | id | index to check |
| char base64Index | ( | char | c | ) |
Returns the base 64 index of the given character.
| [in] | c | character to check |
| bool isAlpha | ( | char | c | ) |
Checks to see if a character is an ASCII representation of hex ((c >= 'A') and (c <= 'F')) || ((c >= 'a') and (c <= 'f'))
| [in] | c | character to check |
| bool isBase64 | ( | char | c | ) |
Returns true if this character is a valid base 64 character or if this is whitespace (A character can be included in a valid base 64 string).
| [in] | c | character to check |
| bool isBase64Digit | ( | char | c | ) |
Returns true if this character is a valid base 64 character.
| [in] | c | character to check |
| bool isDigit | ( | char | c | ) |
Checks to see if a character is an ASCII representation of a digit ((c ge '0') and (c le '9'))
| [in] | c | character to check |
| bool isHex | ( | char | c | ) |
Returns true if this character is a valid hex character or if this is whitespace (The character can be included in a valid hexstring).
| [in] | c | character to check |
| bool isHexAlpha | ( | char | c | ) |
Checks to see if a character is an ASCII representation of hex ((c >= 'A') and (c <= 'F')) || ((c >= 'a') and (c <= 'f'))
| [in] | c | character to check |
| bool isHexDigit | ( | char | c | ) |
Returns true if this character is a valid hex character.
| [in] | c | character to check |
| bool isWhiteSpace | ( | char | c | ) |
Checks to see if a character is whitespace ((c == '
') || (c == '') || (c == '') || (c == ' '))
| [in] | c | character to check |
| ATCA_STATUS packBase64 | ( | const char * | asciiBase64, |
| int | asciiBase64Len, | ||
| char * | packedBase64, | ||
| int * | packedLen | ||
| ) |
Remove white space from a base 64 string.
| [in] | asciiBase64 | Initial base 64 string to remove white space from |
| [in] | asciiBase64Len | Length of the initial base 64 string |
| [in] | packedBase64 | Resulting base 64 string without white space |
| [in,out] | packedLen | In: Size to packedHex buffer Out: Number of bytes in the packed base 64 string |
| ATCA_STATUS packHex | ( | const char * | asciiHex, |
| int | asciiHexLen, | ||
| char * | packedHex, | ||
| int * | packedLen | ||
| ) |
Remove white space from a ASCII hex string.
| [in] | asciiHex | Initial hex string to remove white space from |
| [in] | asciiHexLen | Length of the initial hex string |
| [in] | packedHex | Resulting hex string without white space |
| [in,out] | packedLen | In: Size to packedHex buffer Out: Number of bytes in the packed hex string |


ZIP: 339 Title: Wallet Recovery Words Owners: Daira Emma Hopwood<EMAIL_ADDRESS>Status: Reserved Category: Wallet Discussions-To: <https://github.com/zcash/zips/issues/364>


Before Change
worker_id = pkt.sender_id
assignment_id = pkt.assignment_id
curr_state = self.worker_state[worker_id].assignments[assignment_id]
if not curr_state.is_final():
// Push the message to the message thread to send on a reconnect
curr_state.messages.append(pkt.data)
// Clear the send message command, as a message was recieved
curr_state.last_command = None
self.mturk_agents[worker_id][assignment_id].msg_queue.put(pkt.data)
def _on_socket_dead(self, worker_id, assignment_id):
Handle a disconnect event, update state as required and notifying
After Change
worker_id = pkt.sender_id
assignment_id = pkt.assignment_id
agent = self._get_agent(worker_id, assignment_id)
if agent is None:
self._log_missing_agent(worker_id, assignment_id)
elif not agent.state.is_final():
// Push the message to the message thread to send on a reconnect
agent.state.messages.append(pkt.data)
// Clear the send message command, as a message was recieved
agent.state.last_command = None
agent.msg_queue.put(pkt.data)
def _on_socket_dead(self, worker_id, assignment_id):
Handle a disconnect event, update state as required and notifying
other agents if the disconnected agent was in conversation with them


Sweden probes Iraq minister for 'crimes against humanity'
The prosecutors' body said in a statement that it had received complaints about "an Iraqi minister suspected of crimes against humanity".
Swedish prosecutors said Monday they were investigating an Iraqi government minister for "crimes against humanity", as media reports suggested it related to the shooting dead of hundreds of protesters.
Swedish media identified the subject of their inquiry as Defence Minister Najah al-Shammari, but the statement from the Swedish Prosecution Authority did not name anyone.
The prosecutors' body said in a statement that it had received complaints about "an Iraqi minister suspected of crimes against humanity". The investigation was "in a very early stage", it added.
Several Swedish media outlets, including the country's main dailies, identified him as al-Shammari, reporting that he was also a Swedish citizen, though he goes by a different name in Sweden.
An unnamed Swedish-Iraqi lawyer told Svenska Dagbladet newspaper that he had reported al-Shammari to police in October for his role in the shooting of hundreds of protesters during weeks of unrest.
Since October 1, Iraq's capital and majority-Shiite south have been swept by mass rallies protesting corruption, a lack of jobs and poor services. Those demonstrations have escalated into calls for a complete overhaul of the ruling elite.
An estimated 350 protesters have been killed and thousands wounded in clashes with the security forces, according to a tally compiled by AFP. The authorities in Iraq no longer update their figures.
The defence minister is also under investigation for benefits fraud for claiming housing and child benefits from Sweden despite living in Iraq, according to online news site Nyheter Idag and Swedish newspaper Expressen.
Swedish social insurance agency Forsakringskassan told AFP that they were unable to confirm whether they were investigating al-Shammari as all their cases are classified.
Al-Shammari arrived in Sweden in 2009 and was granted a permanent residency in 2011 before getting his citizenship in 2015, according to Expressen.


REI Explorer
This project included a complex information architecture and interaction design, building a website that pushes people to enjoy the great outdoors and increases purchases through REI.
Role: Research, design and user testing
Tools: Sketch, inVision, Paper iPad app


--- title: A Practical Method for High-Resolution Burned Areas Monitoring using Sentinel-2 and VIIRS keywords: fastai sidebar: home_sidebar nb_path: "nbs/index.ipynb" ---
pip install FireHR
Run the following python code and follow the link to generate the authentication file:
import ee
ee.Authenticate()
Once you are done you should see the message Successfully saved authorization token.
and the file ~/.config/earthengine/credentials
should exist.
Please refer to https://developers.google.com/earth-engine/guides/python_install for more information about the GEE Python API.
firehr_from_banet_events ba100m_PT2020_218.tif
Optional arguments:
| Argument | default | type | description |
|---|---|---|---|
| path | '.' | str | Path to save the outputs. |
| composite_days_before | 120 | int | Time window size in days for the pre-fire data |
| composite_days_after | 120 | int | Time window size in days for the post-fire data |
| max_cloud_fraction | None | float (0.0-1.0) | Remove images with a cloud fraction higher than specified |
| use_least_cloudy | None | int | Select the n least cloudy images in the time_window |
Example using use_least_cloudy
parameter:
firehr_from_banet_events ba100m_PT2020_218.tif --use_least_cloudy 5


{% extends "layout.html" %} {% block page_title %} Money Claims Prototype {% endblock %} {% block content %} {% include "includes/phase_banner_beta.html" %} Upload your statement of accounts Drag and drop files here or Click to choose files Uploaded files No files uploaded {% include 'prototypes/prototype-oct-2018/includes/contact.html' %} {% endblock %} {% block extra_js_1 %} {% endblock %}
Drag and drop files here or Click to choose files


| 1 | package fr.sii.ogham.sms.message.addressing.translator; | |
| 2 | ||
| 3 | import fr.sii.ogham.sms.message.PhoneNumber; | |
| 4 | import fr.sii.ogham.sms.message.addressing.NumberingPlanIndicator; | |
| 5 | import fr.sii.ogham.sms.message.addressing.TypeOfNumber; | |
| 6 | ||
| 7 | /** | |
| 8 | * Phone number handler for short codes. If the sender address is a short code, | |
| 9 | * TON is set to 3, and NPI is set to 0. A number is considered to be a short | |
| 10 | * code if the length of the number is 5 digits or less. | |
| 11 | * | |
| 12 | * @author cdejonghe | |
| 13 | * | |
| 14 | */ | |
| 15 | public class ShortCodeNumberFormatHandler extends AbstractFixedPhoneNumberHandler { | |
| 16 | ||
| 17 | private static final int SHORTCODE_LENGTH = 5; | |
| 18 | ||
| 19 | public ShortCodeNumberFormatHandler() { | |
| 20 | super(TypeOfNumber.NETWORK_SPECIFIC, NumberingPlanIndicator.UNKNOWN); | |
| 21 | } | |
| 22 | ||
| 23 | @Override | |
| 24 | public boolean supports(PhoneNumber phoneNumber) { | |
| 25 |
5
1. supports : negated conditional → NO_COVERAGE 2. supports : negated conditional → NO_COVERAGE 3. supports : negated conditional → NO_COVERAGE 4. supports : changed conditional boundary → NO_COVERAGE 5. supports : replaced boolean return with true for fr/sii/ogham/sms/message/addressing/translator/ShortCodeNumberFormatHandler::supports → NO_COVERAGE |
return phoneNumber != null && phoneNumber.getNumber() != null && phoneNumber.getNumber().length() <= SHORTCODE_LENGTH; |
| 26 | } | |
| 27 | } | |
Mutations | ||
| 25 |
1.1 2.2 3.3 4.4 5.5 |


Sarasota, situated in the Florida Keys, is a centre for the arts and theatre. It also has a great variety of restaurants as well as the ever-popular Saturday morning Farmers Market.
This is a Port of Entry.
See USA Formalities for full details on clearing into and out of the USA.
Last updated September 2016.
There are several marinas, many accessed through locks.
Moorings
The 35 of the 109 planned moorings in the city's main anchorage are now in place. Maximum length 20m (60ft). Call ahead to reserve a mooring. Both long-term and short term rental is available. Berth at the fuel dock in Marina Jacks and report to the Harbour Master, who will allocate a mooring. After hours, tie to a free mooring and report in the morning. Free water taxi to the marina and access to the facilities there.
Anchorage
Anchoring is only permitted 150 feet outside the mooring field or from any waterfront property. The Bickel's Bayou mooring field however is exempt from this restriction and everybody can anchor there due to the private ownership status.
Bickel's Bayou offers free anchoring to cruising sailors. The Ginsberg-Klemmts welcome all cruisers to use the anchorage, "but we can't guarantee that someone won't complain," warns owner Erika, who understands the anchoring rights issues all too well from their travels. Find out full details at the Waterway Guide.
Last updated November 2015.


People hurl chairs at each other during Qawwali event in Haridwar. Video is viral
A Qawwali event in Haridwar turned violent when people started hurling chairs at each other. The video went vira.
by Asian News InternationalA Qawwali event in Haridwar turned into an unruly event after a fight broke out over the seating arrangement. People hurled chairs at one another during the event.
The incident occurred on November 19 at Mohalla Kaithwar in Haridwar. However, no one suffered severe injuries during the quarrel, news agency ANI reports.
In a video shared by ANI, people were seen brutally attacking each other with chairs. Later, police officials intervened to control the clash.
Watch the video here:
The video has been frequently shared on Twitter while people posted funny reactions in the comments section.
Meanwhile, Kamlesh Upadhyay, Superintendent of Police (SP), Haridwar, said that the case will be investigated.
"A few boys threw chairs at each other but police personnel were present there so we did enquire the matter. We are identifying the people involved in this matter. We will investigate the case," Kamlesh Upadhyay was quoted as saying by ANI.


[gecode-users] Are you looking for me
announce-owner at gecode.org
announce-owner at gecode.org
Wed Oct 12 04:09:13 CEST 2011
Hola my precious!
The reduction of the universe to a single being, the expansion of a single being even to God, this is love.
Hello Honey! I would like to tell you a bit about myself.
I'm tall with a middle figure.
I have long blond, very beautiful hair, small nice nose, perfect lips and big blue eyes.
I am a sociable easy going person, so I like meeting friends, going out, have fun and new something interesting.
I'm looking for a strong relations with a caring and smart man!
I am really tired of all these temporary relations.
I would like to find a man who will be able to estimate not only my beauty, but also my brain and my soul...
I want him to kind and handsome, brave and tender, romantic and honest.
my site: www.seekforyou.ru
my sweet, kisses
Stazy
More information about the users
mailing list


My name is Valerio Vaudi, I'm a Computer Engineer, graduated at the University "La Sapienza" of Rome. I was born in Anzio on 14th december of 1985. Since the age of 8 years, I have been in contact with Computers. The passion has transmitted by my uncle Cruciani Felice, person to whom I owe so much and to which they are affectionate, it has been he that I gifted my first computer, a Sony with a built-in MSX BASIC. The computer being used and quite old and it wasn't attractive as gaming machine and the only inviting job was programming. In this way I started programming in Basic since 8 years old. After the high school I entred in the faculty of computer engineering. During degree and master degree, I learned Java, C/C++, Sql, Software engineering technique, UML, ER, BPMN 2.0, BPEL, SOAP WS. The my Master thesis was on how build a microservice system in a cloud native architecture


EBD - Easton Bible DIctionary
Archite
ARCHITE
"ARCHITE "the usual designation of Hushai (
2 Samuel 15:32
;
17:5, 14
;
1 Chronicles 27:33
), who was a native of Archi. He was “the king’s friend”, i.e., he held office under David similar to that of our modern privy councillor.
"ARCHITE "the usual designation of Hushai (2 Samuel 15:32; 17:5, 14; 1 Chronicles 27:33), who was a native of Archi. He was “the king’s friend”, i.e., he held office under David similar to that of our modern privy councillor.


Name: Ayan Sinha
Profile: Martial Art Player
Email<EMAIL_ADDRESS>Phone: (+91)<PHONE_NUMBER>
Skill
Kickboxing BrownAyan Sinha is a passionate Indian Athlete from Nagpur settled in Pune Maharashtra. he have represented India in different martial arts platform.
Ayan have expertise in martial arts like Kickboxing, MMA, Pankration, Karate, belt- wrestling and mas-Wrestling. Recently, Ayan Represented India in World Kempo sport (Form of MMA) world championship and have bagged a Gold wining World Championship title.
Ayan is also a part of Indian Olympic Contingent and has represented India in 5th Asian Indoor& Martial Arts Games in 2017, held at Ashgabat, Turkmenistan. In Pankration World Championship Ayan have bagged 2 medals in 2017 and 2018 at Russia and Belarus.
45
TRAINING COMPLETED6
YEARS OF EXPERIENCE150
PLAYERS DEFEATED36
MEDALS WONGreat achievement is usually born of great sacrifice, and is never the result of selfishness.
Curabitur arcu erat, accumsan id imperdiet et, porttitor at sem. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Curabitur arcu erat, accumsan id imperdiet et, porttitor at sem. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem ipsum, dolor sit amet consectetur adipisicing elit.
Proin eget tortor risus. Pellentesque in ipsum id orci porta dapibus. Praesent sapien massa, convallis a pellentesque nec, egestas non nisi.
Proin eget tortor risus. Pellentesque in ipsum id orci porta dapibus. Praesent sapien massa, convallis a pellentesque nec, egestas non nisi.
Proin eget tortor risus. Pellentesque in ipsum id orci porta dapibus. Praesent sapien massa, convallis a pellentesque nec, egestas non nisi.


{% include 'nav.html' %}
Routes
Just a minute! We are loading Ceryx' routes.
Add new route
{% include 'modals/add-new-route.html' %}


Son of Egypt’s former President Mubarak says mother ill
by The Associated PressCAIRO (AP) — One of the sons of Egypt’s former autocratic President Hosni Mubarak says his 78-year-old mother and former first lady is in hospital.
Alaa Mubarak tweeted late Wednesday that Suzanne Mubarak was in intensive care but didn’t elaborate on her illness. He sought to reassure his followers and tweeted: “Things will be fine, God willing!”
During Hosni Mubarak’s 30-year-long rule, his wife had enjoyed significant political power and championed several projects, including efforts to eradicate female genital mutilation.
The 91-year-old Mubarak was ousted in the 2011 uprising that swept Egypt as part of the Arab Spring movements across the region. He was sentenced to life imprisonment but later retried and subsequently acquitted and released in 2017.
Mubarak’s two sons, Alaa and Gamal, were both convicted and served terms for corruption.
The Associated Press


Thyssenkrupp to cut 640 jobs in its ailing System Engineering business
System Engineering, which makes assembly lines for the car, aerospace and battery industries
by ReutersGerman conglomerate Thyssenkrupp on Wednesday said it planned to cut 640 jobs at its System Engineering unit, which it put under review earlier this year.
System Engineering, which makes assembly lines for the car, aerospace and battery industries, had been put under review in August in an attempt to address Thyssenkrupp's cash burn.


Browse the jobs that have been posted by people in Qatar looking for Talent. Jobs are updated daily so be sure to check back. If you're looking for a Talent.


--- layout: post title: Realize categories: [] tags: realize status: publish type: post published: true meta: {} ---
Spending most of my days alone in an office I love the occasions when I get to meet some of the people who use CM. One of the most enjoyable experiences is hearing directly from people who need a particular fix/feature and then being able to go back to my office and make that happen.
I, along with various other CM developers, will be at Realize this year, I will not venture beyond Melbourne but members from the dev team will be at all the Realize events.
Come along, tell us your stories and shine a light into the long lonely months in the office.


--- title: Functions keywords: fastai sidebar: home_sidebar summary: "This module contains implementations of both traditional survival analysis functions, as well as the loss functions associated with uncensored data, as defined in the original DRSA paper." description: "This module contains implementations of both traditional survival analysis functions, as well as the loss functions associated with uncensored data, as defined in the original DRSA paper." ---
Following the notation used in the the DRSA paper, we define the following:
Let $z$ be the true occurrence time for the event of interest.
Let $t$ be the time that a given data point was observed.
For each observation, there exist $L$ time slices, ie $0 < t_1 < t_2 < \dots < t_L$, at which we either observe the event (uncensored) or do not (censored).
Let $V_l = (t_{l-1}, t_l]$ be the set of all disjoint intervals with $l = 1, 2, \dots, L$.
Though it's given its own name is survival analysis, the survival function is simply calculated as $1 - \text{CDF}(z)$. In the discrete, empirical case, the survival function is estimated as follows (this is equation (5) in the paper).
{% raw %} $$ S(t_l) = Pr(z > t_l) = \sum_{j > l}Pr(z\in V_j) $$ {% endraw %}
# example
h1 = torch.tensor([[0.001],
[0.5],
[0.55],
[0.15],
[0.15],
[0.15],
[0.15],
[0.9]], requires_grad=True)
h2 = torch.tensor([[0.001],
[0.005],
[0.1],
[0.11],
[0.12],
[0.15],
[0.15],
[0.9]], requires_grad=True)
h = torch.stack([h1, h2], dim=0)
survival_rate(h)
# example
event_rate(h)
# example
event_time(h)
The conditional hazard rate is the quantity which will be predicted at each time step by a recurrent survival analysis model. In the discrete, empirical case, it is estimated as follows (this is equation (7) in the paper).
{% raw %} $$h_l = Pr(z\in V_l | z > t_{l-1}) = \frac{Pr(z\in V_l)}{Pr(z>t_{l-1})} = \frac{p_l}{S(t_{l-1})}$$ {% endraw %}
#example
log_survival_rate(h)
# example
log_event_rate(h)
# example
log_event_time(h)
Now, we define the transform these generic survival analysis functions into loss functions that can be automatically differentiated by PyTorch, in order to train a Deep Recurrent Survival Analysis model.
We make a few notes below:
The functions below adhere to the common pattern used across all of PyTorch
's loss functions, which is to take two arguments named input
and target
. We note, however, that due to the nature of this survival data, the target is inherent to the data structure and thus unnecessary.
The original DRSA paper defines 3 loss functions, 2 of which are directed towards uncensored data, and 1 of which applies to censored data. This library's focus is on DRSA models using only uncensored data, so those are the only lossed we'll be defining.
# example
event_time_loss(h)
# example
event_rate_loss(h)


{% extends "base.html" %} {% block title %}Account activated successfully{% endblock %} {% block content %}
Thank you for taking your time to complete the registration process! Your account is now active.