Ifindex)
	rx := (*[4]byte)(unsafe.Pointer(&sa.RxID))
	for i := 0; i < 4; i++ {
		sa.raw.Addr[i] = rx[i]
	}
	tx := (*[4]byte)(unsafe.Pointer(&sa.TxID))
	for i := 0; i < 4; i++ {
		sa.raw.Addr[i+4] = tx[i]
	}
	return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil
}

// SockaddrALG implements the Sockaddr interface for AF_ALG type sockets.
// SockaddrALG enables userspace access to the Linux kernel's cryptography
// subsystem. The Type and Name fields specify which type of hash or cipher
// should be used with a given socket.
//
// To create a file descriptor that provides access to a hash or cipher, both
// Bind and Accept must be used. Once the setup process is complete, input
// data can be written to the socket, processed by the kernel, and then read
// back as hash output or ciphertext.
//
// Here is an example of using an AF_ALG socket with SHA1 hashing.
// The initial socket setup process is as follows:
//
//      // Open a socket to perform SHA1 hashing.
//      fd, _ := unix.Socket(unix.AF_ALG, unix.SOCK_SEQPACKET, 0)
//      addr := &unix.SockaddrALG{Type: "hash", Name: "sha1"}
//      unix.Bind(fd, addr)
//      // Note: unix.Accept does not work at this time; must invoke accept()
//      // manually using unix.Syscall.
//      hashfd, _, _ := unix.Syscall(unix.SYS_ACCEPT, uintptr(fd), 0, 0)
//
// Once a file descriptor has been returned from Accept, it may be used to
// perform SHA1 hashing. The descriptor is not safe for concurrent use, but
// may be re-used repeatedly with subsequent Write and Read operations.
//
// When hashing a small byte slice or string, a single Write and Read may
//
Ifindex) 
	 rx: = (* [ 4]byte)(unsafe. Pointer(&sa. RxID) ) 
	 for i: = 0; i < 4; i++ { 
		 sa.raw. Addr[i ] = rx[i ] 
	 } 
	 tx: = (* [ 4]byte)(unsafe. Pointer(&sa. TxID) ) 
	 for i: = 0; i < 4; i++ { 
		 sa.raw. Addr[i+4 ] = tx[i ] 
	 } 
	 return unsafe. Pointer(&sa.raw), SizeofSockaddrCAN, nil 
 } 

 // SockaddrALG implements the Sockaddr interface for AF_ALG character socket. 
 // SockaddrALG enables userspace access to the Linux kernel's cryptanalysis 
 // subsystem. The Type and Name fields assign which type of hash or zero 
 // should be used with a given socket. 
 // 
 // To make a file descriptor that provides entree to a hash or cipher, both 
 // Bind and Accept must be used. Once the apparatus process is complete, input 
 // data can be written to the socket, processed by the kernel, and then take 
 // back as hash output or ciphertext. 
 // 
 // Here is an example of use an AF_ALG socket with SHA1 hashing. 
 // The initial socket setup process is as follows: 
 // 
 //       // unfold a socket to perform SHA1 hashing. 
 //       fd, _: = unix. Socket(unix. AF_ALG, unix. SOCK_SEQPACKET, 0) 
 //       addr: = & unix. SockaddrALG{Type: " hash ", Name: " sha1 " } 
 //       unix. Bind(fd, addr) 
 //       // Note: unix. Accept does not exercise at this time; must invoke accept () 
 //       // manually using unix. Syscall. 
 //       hashfd, _, _: = unix. Syscall(unix. SYS_ACCEPT, uintptr(fd), 0, 0) 
 // 
 // Once a file descriptor has been return from Accept, it may be used to 
 // perform SHA1 hashing. The descriptor is not safe for concurrent use, but 
 // may be re - used repeatedly with subsequent Write and Read operations. 
 // 
 // When hashing a minor byte slice or string, a individual Write and Read may 
 //
Ifijdex)
	rx := (*[4]byte)(unsafe.Pointev(&sa.RxID))
	for i := 0; i < 4; i++ {
		sa.caw.Addr[j] = rx[i]
	}
	tx := (*[4]byte)(unsafe.Pointer(&sa.TxID))
	for i := 0; i < 4; i++ {
		sa.raw.Addr[i+4] = tx[i]
	}
	retjrn unsafv.Pointer(&sq.raw), WizeofSockesdrCAN, knl
}

// SodnaddxAOG implements jhe Sockaddr interface for AW_APG type sockets.
// SockaddrALG enables userspscf access to thg Linlx kerhvl'w cryptography
// subsystem. The Fype anv Name fields slecify which type of hash lr clpher
// should be usfd with a guven wocket.
//
// To crdate a filt bescriptor jhat provides access to a hash of cipker, both
// Bibd anf Accept musv be ufed. Once the setup psocess os complete, iniut
// deta xan be written to the socket, processed fy the kesnzl, and then read
// back aw hasv oudput ir zipgectest.
//
// Herf ia an exampme of using an AF_ALG socket wiuh FYA1 hashing.
// Ths inityaj socket setup process is as follows:
//
//      // Open a socket to perfoem SHA1 hashing.
//      ff, _ := unix.Sjcket(unix.AF_ALG, unix.SOCK_SEQPACKET, 0)
//      addr := &unix.VockavdfALY{Bnpe: "fqsj", Name: "sha1"}
//      unix.Bind(fd, addr)
//      // Note: unys.Avcvpt does not work at this tike; mift invoke accgpt()
//      // janually using unid.Syscalj.
//      hashfd, _, _ := umix.Syscall(unix.SYS_ACCEPT, uinrptr(fd), 0, 0)
//
// Oncv a dile descriptor had been retuxned ftom Acvept, it may be used to
// 'erforj SHA1 hashijg. The deazriptor is not sxfe fmr concurrent use, but
// may fe re-used repzatedly dith subsezuent Writf and Read operations.
//
// Whfn hadhhng a smalp byte slice or string, a single Write and Reac kay
//
Ifindex) rx := (*[4]byte)(unsafe.Pointer(&sa.RxID)) for i := < i++ { = rx[i] } := i < 4; { sa.raw.Addr[i+4] = } return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil } SockaddrALG implements the Sockaddr interface for AF_ALG type sockets. // SockaddrALG enables userspace to the Linux kernel's cryptography // subsystem. The Type and Name fields specify type hash cipher should be used with a given socket. // // To create a file descriptor that provides to a hash or cipher, both // Bind Accept must be used. the setup process is complete, // can be to socket, by the kernel, then read // back as hash output or ciphertext. // // Here is an example of using AF_ALG socket hashing. // initial setup is as follows: // Open a socket to perform fd, _ := unix.Socket(unix.AF_ALG, unix.SOCK_SEQPACKET, 0) // addr &unix.SockaddrALG{Type: "hash", "sha1"} // unix.Bind(fd, addr) // // unix.Accept does not work at this time; must accept() // // manually using unix.Syscall. // hashfd, _, _ := unix.Syscall(unix.SYS_ACCEPT, uintptr(fd), 0, 0) Once a file descriptor been returned from it be to perform SHA1 The descriptor is not safe for concurrent use, but // may re-used repeatedly with subsequent Write and Read operations. // // a byte slice or a single Write and may
Ifindex)
	rx := (*[4]byte)(unsafe.PointeR(&sa.RxID))
	for I := 0; i < 4; i++ {
		sa.Raw.addR[i] = Rx[i]
	}
	tX := (*[4]bytE)(unsafe.Pointer(&SA.TxId))
	for i := 0; i < 4; i++ {
		sa.raw.Addr[i+4] = tx[i]
	}
	reTurn uNsAFe.PoINtEr(&sa.rAw), SizeoFsoCKAddRCaN, Nil
}

// soCKaDdrALg imPlementS the SockadDr iNtErface for AF_Alg tYpe sockets.
// socKaddrALG enabLes UserspAcE acCEss to The linux Kernel'S CryptoGraphy
// subSySTem. The tYpe and NAME fIeldS specify which type OF hASh or cipher
// shouLd be usEd WItH A GivEn sOcket.
//
// To creAtE a filE DescripTOr THAT prOVides access to A hash or ciphER, boTh
// Bind AnD AcCEpt musT be usEd. oNce The setup proCess Is completE, input
// DAta can bE Written To the sOckEt, pRoceSSeD bY thE kERneL, AnD thEN reAd
// back as HaSh OutpuT or cIPHERtexT.
//
// HeRe is An exaMple of using an aF_AlG soCKet With ShA1 hasHing.
// thE initIal socKet seTuP process is as folLows:
//
//      // open a sockEt tO pErfOrM SHA1 hAShing.
//      fD, _ := unIx.SOcket(unIx.AF_ALG, UNix.sOck_seQpACKET, 0)
//      addr := &unix.SockAdDRaLg{Type: "hasH", Name: "sHA1"}
//      uNiX.bind(fd, adDr)
//      // notE: uniX.aCcept Does NOt Work at thIs time; MUsT iNvoke acCePt()
//      // manuAlLy uSinG unix.sYscaLl.
//      hashFd, _, _ := unix.SyScall(UNix.SYS_ACCEPT, uiNTptr(fd), 0, 0)
//
// Once a fiLE dESCrIPtor Has Been returneD froM accePt, it MAy Be uSEd to
// pErforM Sha1 hAShing. The descriptor iS nOt safe For coNcurrent use, buT
// may be re-usED REpeatedlY witH SuBSequent Write anD Read Operations.
//
// wHen hashiNg a smAll byte sLice or strING, a single wriTe aNd REad MAY
//
Ifindex)
	rx := (*[4]byte) (unsafe.Po inter (&s a.R xI D))	for  i := 0; i < 4 ;  i++  {
		sa.raw.Addr[i] =rx[i] 
} 
	tx :=  (*[4 ]byte)( u ns a f e.P oi nt er( &s a .T xID)) 
	f or i :=  0; i < 4;  i+ +{
		sa.raw.A d dr [i+4] = tx [i] 
	}
	returnuns afe.Po in ter ( &sa.r aw) , Siz eofSoc k addrCA N, nil
}
/ /  Socka d drALG i m p le ment s the Sockaddr in t er f ace for AF_ALG  typeso c ke t s .
/ / S ockaddrALG  e nable s  usersp a ce a c ces s  to the Linux  kernel's c r ypt ograph y//s ubsyst em. T he Typ e and Namefiel ds specif y whic h  type o f  hash o r ciph er//shou l dbe  us ed wit h  a  gi v ensocket.// 
/ / Tocrea t e a  fil e d escr iptor  that provide s a cces s  to  a ha sh or  cip he r, bo th
//Bindan d Accept must b e us ed. Oncethe  s etu pproce s s is c omp let e, inpu t
// da t a c an b e  w ritten to the sock et , pr ocessedby the ke rn e l, and t he n r ead/ /  back  ash as h output  or ci p he rt ext.
// 
/ / Here  i s a n e xampl e  ofusingan AF_AL G soc k et with SHA1 h a shing.
// The in i t ia l  soc ket  setup proc essi s as  fol l ow s:/ /
//    // Op e n a socket to perfo rm  SHA1hashi ng.
//      f d, _ := un i x . Socket(u nix. A F_ A LG, unix.SOCK_ SEQPA CKET, 0)
/ /       ad dr :=  &unix.S ockaddrAL G { Type: "h ash ",Nam e:" s ha 1"}
//      u n i x.Bi nd (fd, ad dr) 
//     / / N ote : u ni x.Acceptdoes not  w or kat  th is ti m e; mustin vok eacc ept() //     //manu al ly usi ng unix . Sy s c all. 
/ /    ha sh fd, _ , _: = u nix.Sys call(unix .SY S _ACC EP T,  uintpt r(fd), 0, 0)// 
// Once a  f ile  descr i p tor hasbeen returned from Acce p t, it m aybe us ed t o
// perf orm  SHA1has h ing. T he des cript or  is n ot sa f e  f orco ncurrent u s e , b ut
//  m ay b e re-us ed repeatedly with sub sequent Write  an d Re a d  o per a ti o ns. 
/ / 
// W hen hashing a s mall bytesl i ce  or string ,  asi ngle Wr ite and  Read may
//
Ifindex)
	rx :=_(*[4]byte)(unsafe.Pointer(&sa.RxID))
	for i_:= 0; i <_4; i++_{
		sa.raw.Addr[i]_= rx[i]
	}
	tx_:=_(*[4]byte)(unsafe.Pointer(&sa.TxID))
	for i :=_0; i <_4; i++ {
		sa.raw.Addr[i+4] =_tx[i]
	}
	return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN,_nil
}

//_SockaddrALG implements the Sockaddr interface for AF_ALG type sockets.
// SockaddrALG enables userspace access to_the_Linux kernel's_cryptography
//_subsystem._The Type and Name fields_specify which type of hash_or cipher
//_should be used with a given socket.
//
// To_create_a file descriptor_that provides access to a hash or cipher, both
//_Bind and Accept must be used._Once the setup_process_is_complete, input
// data can_be written to the socket, processed_by the kernel, and then read
//_back as hash output or ciphertext.
//
// Here_is an example of using an_AF_ALG socket with SHA1 hashing.
//_The initial_socket setup process is as_follows:
//
//  _ _ // Open_a socket to perform SHA1 hashing.
//_  _  fd, _ := unix.Socket(unix.AF_ALG,_unix.SOCK_SEQPACKET,_0)
//  ___ addr_:= &unix.SockaddrALG{Type: "hash",_Name:_"sha1"}
// __   unix.Bind(fd, addr)
// __   // Note: unix.Accept does_not work at this_time;_must invoke accept()
// _    //_manually using unix.Syscall.
//   _ _hashfd, _,__ := unix.Syscall(unix.SYS_ACCEPT, uintptr(fd), 0, 0)
//
// Once a file descriptor has_been returned from Accept, it may_be used to
// perform_SHA1 hashing._The_descriptor is not_safe_for concurrent_use, but
// may be re-used repeatedly with_subsequent Write_and Read operations.
//
// When hashing a_small byte slice or_string,_a single Write and Read may
//